#include using namespace std; int main() { int num,prime; cout << "\n\n\nWelcome to the prime program!\n\n\n"; num=2; while (num != 0) { cout << "Enter an integer greater than 2 (0 to quit): "; cin >> prime; //breaks out of the program if the user enters 0 if (prime == 0) break; //this while loop performs the actual operations to determine not prime while (prime > num) { if ((prime%num) == 0) { cout << prime << " is divisible by "<< num << " so it is not prime!\n\n"; num=2; break; } num+=1; } //if we make it all the way through all the factors and none go in evenly, then we know it is prime if (prime==num) { cout << "The number " << prime << " is prime!\n\n"; num=2; } } cout << "Thanks for playing.\n\n"; system("pause"); }