Question: Write a program that will test if a users input of an integer is a prime number or not. To test if a number is

Write a program that will test if a users input of an integer is a prime number or not. To test if a number is prime or not, check whether it is divisible by 2, 3, 4 and so on up to half the number size (number/2). If a divisor is found, the number is not prime. (in other words, if there was a remainder of zero, then the number is not a prime.) Ex. If the user input is 31, the output should say that 31 is a prime number. If the user input is 35, the output should say that 35 is not a prime number. The program should use a prompt to ask the user for input to enter a number to check if it is prime or not. Also, you should present the result in a useful formatted output to the user. The program should continue to ask the user to enter another integer until the user enters 0. If the user enters a 0, the program should print a note stating End of program execution. And stop the program

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