Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit32a6e0cf7e89a5ff043b09ef18aa22d9f9cd98b6 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2021-10-25 15:12:29 +0300
Committer
 GitHub <noreply@github.com>
2021-10-25 15:12:29 +0300
Files68e9dd7ae32a4698d7a279feb32576a6c14de2e0
Introduction_to_programming_FMI-32a6e0cf7e89a5ff043b09ef18aa22d9f9cd98b6.tar
Introduction_to_programming_FMI-32a6e0cf7e89a5ff043b09ef18aa22d9f9cd98b6.tar.gz
Introduction_to_programming_FMI-32a6e0cf7e89a5ff043b09ef18aa22d9f9cd98b6.zip
Parentfd864096400d7fd18c0e22cdb8b14c249be75ca2 (diff)
Update example 4 - prime number.cpp
1 files changed, 36 insertions, 0 deletions
-rw-r--r--Sem. 03/example 4 - prime number.cpp36
diff --git a/Sem. 03/example 4 - prime number.cpp b/Sem. 03/example 4 - prime number.cpp
index e69de29..521ce9c 100644
--- a/Sem. 03/example 4 - prime number.cpp
+++ b/Sem. 03/example 4 - prime number.cpp
@@ -0,0 +1,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;;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}