Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit2d690dadaf0dc606c59ae688011bac2af48d5d69 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2021-11-05 01:46:21 +0200
Committer
 GitHub <noreply@github.com>
2021-11-05 01:46:21 +0200
Files79da6598f0e248be5c3bb505f3ab73ceab4ca5d3
Introduction_to_programming_FMI-2d690dadaf0dc606c59ae688011bac2af48d5d69.tar
Introduction_to_programming_FMI-2d690dadaf0dc606c59ae688011bac2af48d5d69.tar.gz
Introduction_to_programming_FMI-2d690dadaf0dc606c59ae688011bac2af48d5d69.zip
Parent91c58192153aec6803de90951e2d72b36fcc4e16 (diff)
Update example01_with_functions.cpp
1 files changed, 5 insertions, 2 deletions
-rw-r--r--Sem. 04/example01_with_functions.cpp7
diff --git a/Sem. 04/example01_with_functions.cpp b/Sem. 04/example01_with_functions.cpp
index f33b6b9..64d4367 100644
--- a/Sem. 04/example01_with_functions.cpp
+++ b/Sem. 04/example01_with_functions.cpp
@@ -1,8 +1,11 @@
#include <iostream>
using namespace std;
-bool isPrime(int n)
+bool isPrime(unsigned n)
{
+ if(n <= 1)
+ return false;
+
double temp = sqrt(n);
for (int i = 2; i <= temp; i++)
@@ -24,4 +27,4 @@ int main()
if (isPrime(i - 1) && isPrime(i + 1))
cout << i - 1 << " " << i + 1 << endl;
}
-} \ No newline at end of file
+}