/* Write a program to read a positive integer n greater than 1 and 
to print if n is prime. If n is less than or equal to 1, print an error 
message. This one is with repetition.
*/

#include <iostream>
using namespace std;
int main()
{
	int i, n, count;
	char ch = 'Y';
	while (toupper(ch) == 'Y')
	{
		system("cls");
		cout << "Enter a pos. integer > 1: ";
		cin >> n;
		count = 0;
		if (n > 1)
		{
			for (i = 2; i < n; i++)
				if (n % i == 0)
				{
					count++;
				}
			if (count == 0)
				cout << n << " is prime.\n";
			else
				cout << n << " is not prime.\n";
		}
		else
			cout << "The number should be > 1.\n";
		cout << "Continue? If yes, press y or Y: ";
		cin >> ch;
	}
	return 0;
}
