Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / example 4 - prime number.cpp
blob: d93a583087354263e8386d4bd50d00c198d2ec8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;


int main()
{
	int n;
	cin >> n;

	bool isPrime = true;
	double temp = sqrt(n);
	for (int i = 2; i <= temp; i++)
	{
		if (n % i == 0)
		{
			isPrime = false; 
			break;
		}
	}
	cout << isPrime << endl;
}