Question: Program prompts the user to input a positive integer x greater than 1000. If the input value is invalid, prompt the user to input a
Program prompts the user to input a positive integer x greater than 1000. If the input value is invalid, prompt the user to input a valid number. Allow for 5 additional attempts before exiting the program. Inform the user of the remaining number of attempts after each failed one. The program then finds the smallest digit of x by using the smallestDigit function. Then print all prime numbers from 1 to 100 using the isPrime function.You will need to create these functions:bool isPrime(int x) tests if a number is prime. If the given argument is prime, then return true. Otherwise, return false. (ex. isPrime(19) returns true)int smallestDigit(int x) finds the smallest digit in the given argument and returns that value. (ex. smallestDigit(3582) returns 2)

C5111 Extra Credit Please include the answer to the following question in a single file. Ensure the file you send contains the extension .cpp. Comments and proper formatting will be a part of your grade. Submissions that work partially and show some effort will receive partial credit. Write a complete C++ program that does the Following: a. Program prompts the user to input a positive integer x greater than 1606. If the input value is invalid, prompt the user to input a valid number. Allow for 5 additional attempts before exiting the program. Inform the user of the remaining number of attempts after each failed one. The program then finds the smallest digit of x by using the smallestDigit function. Then print all prime numbers from 1 to 100 using the isPrime function. You will need to create these functions: bool isPrime(int x) tests if a number is prime. If the given argument is prime, then return true. Otherwise, return false. (ex. isPrime(19) returns true) int smallestDigit(int x) finds the smallest digit in the given argument and returns that value. (ex. smallestDigit(3582} returns 2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
