Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is meant to be done in C++ The Prime Number Program Write a program to Prompt the user for a candidate number (integer) Determine
This is meant to be done in C++
The Prime Number Program Write a program to Prompt the user for a candidate number (integer) Determine whether or not that number is prime Display the result Prompt for another number (0 to quit) Example run #1: Welcome to the wiz-bang prime number thing! Enter an integer greater than 2 (0 to quit): 35 35 is not prime. Enter an integer greater than 2 (0 to quit): 13 13 is prime. Enter an integer greater than 2 (0 to quit): e Thanks for playing. By definition, prime numbers are divisible only by 1 and themselves. That means a number can be proven to be not prime by finding a factor other than 1 or the number. Therefore, your program should use repetition to try consecutive divisors until either a divisor is found or all potential divisors have been tried. Example 1, to determine that 13 is prime Try dividing 13 by 2 Try dividing 13 by 3 does not come out even does not come out even . Try dividing 13 by 12 does not come out even, 13 must be prime . Example 2, to determine that 35 is not prime Try dividing 35 by 2 Try dividing 35 by 3 . Try dividing 35 by 4 Try dividing 35 by 5 does not come out even does not come out even does not come out even comes out even (35 +5-7), 35 is not prime For 5 points extra credit, display a factor which makes the number not prime. Example 35 is not prime because it's divisible by 5
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