Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Find The Sum of Common Alphabets - Lower Given two char arrays input1[] and input2[] containing only lower case alphabets, extract the alphabets which
Find The Sum of Common Alphabets - Lower Given two char arrays input1[] and input2[] containing only lower case alphabets, extract the alphabets which are present in both arrays (common alphabets). Get the ascii values of all the extracted alphabets. Calculate sum of those ascii values. Lets call it sum1 and calculate single digit sum of sum1, i.e keep adding the digits of sum1 until you arrive at a single digit. Return that single digit as output. Note: 1.Array size ranges from 1 to 10. 2.All the array elements are lower case alphabets. 3. Atleast one common alphabet will be found in the arrays. Example-1 input1: {'a', 'b', 'c'} input2: {'b', 'c'} output: 98 +99 = 197 1+9+ 7 = 17 1+7=8 Explanation: 'b' and 'c' are present in both the arrays. Ascii value of 'b' is 98 and 'c' is 99. Example-2 input1: {'g', 'q', 'r' } input2: {'r', 't', 'u'} output: 114 1+1+4= 6 Explanation: 'r' is present in both the arrays. Ascii value of 'r' is 114.
Step by Step Solution
★★★★★
3.48 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
using System class Intersection public static void sumchar input1 char input2 int n input1Lengt...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started