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 2
Revisit Later
How to Attempt?
Write a C/Java 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 -1, if the string is empty or if the string has only non Alpha numeric characters
E.x 1. if the String is "aAc", then the value of ASCII value multiplication is as follows 97*65**99=624195. Hence Magic value is 624195
If the String is "a$123456", then the magic value is 63024800, note that processing '4' results in the magic value exceeding maximum integer value and hence characters 4,5 and 6 are ignored in the calculation. Also '$' and '@' are ignored as they are not Alpha numeric.
 Question 2 Revisit Later How to Attempt? Write a C/Java program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!