Answered step by step
Verified Expert Solution
Link Copied!

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

image


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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis And Decision Making

Authors: Christian Albright, Wayne Winston, Christopher Zappe

4th Edition

538476125, 978-0538476126

More Books

Students also viewed these Programming questions