Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions

Question

Define and measure service productivity.

Answered: 1 week ago