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)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started