Question: Question 2 Revisit Later How to Attempt? Write a C / Java program to find the Magic value of a given input String. Magic value
Question
Revisit Later
How to Attempt?
Write a CJava program to find the Magic value of a given input String. Magic value is an integer value formed by multiplying the ASCII value.of each character starting from beginning of the string, with following rules:
If the result of the calculation exceeds maximum integer value, ignore processing that and rest of the characters in the string
Only Alpha Numeric characters are taken for calculation. When you encounter any character other than Alpha Numeric ignore them.
Return if the string is empty or if the string has only non Alpha numeric characters
Ex if the String is "aAc", then the value of ASCII value multiplication is as follows Hence Magic value is
If the String is a$ then the magic value is note that processing results in the magic value exceeding maximum integer value and hence characters and are ignored in the calculation. Also $ and @ are ignored as they are not Alpha numeric.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
