Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / SimpleDevidersCount_PrimalityCheck.cpp
blob: fee3540b1534d5b1ee29e2562df31ebd39c0f5de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>

using namespace std;

int main()
{
	unsigned int n; //allways positive int
	cin >> n;

	int divCount = 0;

	for (int i = 1; i <= n; i++)
	{
		if (n%i == 0)
			divCount++;
	}

	if (divCount == 2)
	{
		cout << "Prime" << endl;
	}
	else
	{
		cout << "Not a prime" << endl;
	}

	

}