From 2d690dadaf0dc606c59ae688011bac2af48d5d69 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Fri, 5 Nov 2021 01:46:21 +0200 Subject: Update example01_with_functions.cpp --- Sem. 04/example01_with_functions.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Sem. 04/example01_with_functions.cpp') 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 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 +} -- cgit v1.3.1-23-gd82d