Skip to content

Commit d94bf0a

Browse files
authored
Add files via upload
1 parent 782c296 commit d94bf0a

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

Prime Number or Not using sqrt.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
///Prime Number or Not using sqrt
2+
3+
/**
4+
*
5+
* author :: 101rror
6+
*
7+
**/
8+
9+
#include <bits/stdc++.h>
10+
11+
using namespace std;
12+
13+
#define MAX 100
14+
#define infinity 1000000000000000LL
15+
#define all(x) (x).begin(),(x).end()
16+
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
17+
#define mod(x,m) ((x%m)+m)%m; //101rror
18+
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL))
19+
20+
#define T while(t--)
21+
#define for2(i,a,b) for(i=a;i>=b;i--)
22+
#define for3(i,a,b) for(i=a;i<=b;i=i+2)
23+
#define for1(i,a,b) for(i=a;i<=b;i=i+1)
24+
#define for4(i,a,b) for(i=a;i>=b;i=i-2)
25+
26+
#define fi first
27+
#define se second
28+
#define pb push_back
29+
#define eb emplace_back
30+
31+
#ifdef LOCAL
32+
#include "algo/debug.h"
33+
#else
34+
#define debug(...) 42
35+
#endif
36+
37+
38+
int main()
39+
{
40+
ios::sync_with_stdio(false);
41+
cin.tie(0);
42+
fastread();
43+
44+
int num, count = 0;
45+
cin >> num;
46+
47+
for(int i = 2; i <= sqrt(num); i++)
48+
{
49+
if(num % i == 0)
50+
{
51+
count++;
52+
}
53+
}
54+
55+
if(count == 0)
56+
{
57+
cout << endl;
58+
cout << num << " is Prime Number.";
59+
cout << endl;
60+
}
61+
62+
else
63+
{
64+
cout << endl;
65+
cout << num << " is not Prime Number.";
66+
cout << endl;
67+
}
68+
69+
return 0;
70+
}

0 commit comments

Comments
 (0)