Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that allows the user to enter positive integers unitil zero

ID: 646006 • Letter: W

Question

Write a C++ program that allows the user to enter positive integers unitil zero is input. After each integer is input a function is called to determine if the last integer input was a prime number. Main() should output the value teste whether it was a prime or not?

Example run:

please input a positive integer or zero to exist the program

5 the value is prime

please input a positive integer or zero to exist the program

40 the value is not prime

please input a positive integer or zero to exist the program

15 the value is not prime

please input a positive integer or zero to exist the program

0 thanks for playing - goodbye

Explanation / Answer

#include #include using namespace std; int main() { int number; do{ cout number; if((number%2==0) ||(number%3==0) || (number%4==0)||(number%5==0)||(number%6==0)|| (number%7==0)||(number%8==0)||(number%9==0)) cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote