Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / SimpleDevidersCount_PrimalityCheck.cpp
blob: db39c9c6c80e6dad472ea96757536d519187da95 (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
30
#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++;
	}
	//Can we reduce the number of steps?
	
	if (divCount == 2)
	{
		cout << "Prime" << endl;
	}
	else
	{
		cout << "Not a prime" << endl;
	}

	

}