We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96fdbf8 commit 21d0275Copy full SHA for 21d0275
Prime-Check(Naive).cpp
@@ -0,0 +1,25 @@
1
+#include <cstdio>
2
+
3
+using namespace std;
4
5
+bool check(int x)
6
+{
7
+ for (int i = 2; i * i <= x; i++)
8
+ {
9
+ if (x % i == 0)
10
11
+ return false;
12
+ }
13
14
+ return true;
15
+}
16
17
+int main()
18
19
+ int n;
20
+ while (scanf("%d", &n) > 0)
21
22
+ printf("%s\n", check(n) == true ? "YES" : "NO");
23
24
+ return 0;
25
0 commit comments