diff options
1 files changed, 5 insertions, 2 deletions
| -rw-r--r-- | Sem. 04/example01_with_functions.cpp | 7 |
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 +}
|
