Question: In this assignment you may use only the functions from and whenever appropriate (i.e. no libraries like , , or ).Part b) The Mathematician has

 In this assignment you may use only the functions from andwhenever appropriate (i.e. no libraries like , , or ).Part b) TheMathematician has written a list of s-Primes on paper and asked his

In this assignment you may use only the functions from and whenever appropriate (i.e. no libraries like , , or ).Part b) The Mathematician has written a list of s-Primes on paper and asked his assistant to key in the values into the computer. However, the assistant might have accidentally clashed on the number pad which resulted in one excessive digit at unknown position. In part b) you will write a program to recover the possible original s-Prime(s). The program will read in a non-negative integer which fits in a 32bit integer. (already includes that possibly unneeded digit, no error checking is needed). The count of excessive digit is zero (i.e. no typo) or at most one. If there are several possible unique candidates, print the numbers in ascending order. If it's not possible to recover the original s-Prime, print "No Solution". The excessive digit could be at any position within the number. However, since the original number is represented as simplest form, for cases like 103, the first digit here (i.e. 1) is not excessive, because the assistant never types 03. For information, the possible candidates here are: 13 (extra 0 in the middle) or 10 (extra 3 at the end). Similar to part a), the time limit of 2 seconds applies.Sample Input I Output: Example 1: (User Input Is underlined) Input an integer: g; The original number could be: 2 3 23 Example 2: (User Input Is underlined) Input an integer: lg; The original number could be: 23 Example 3: (User Input Is underlined} Input an integer: 1;; The original number could be: 11 Example 4: (User Input Is underlined} Input an integer: 1623 No solution Example 5: (User Input Is underlined) Input an integer: 216966129? The original number could be: 21696129? 21966129

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 Programming Questions!