Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / example 4 - prime number.cpp
blob: 521ce9c72b91652cf7f0c1ace059c766a177e8fa (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
31
32
33
34
35
36
#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;;
}
	













}