16.29
2include <iostream>
3#include <iomanip>
4using namespace std;
5
6bool isPrimeHalf(int number)
7{
8 for (int i = 2; i <= number / 2; i++)
9 if ((number % i) == 0)
10 return false;
11 return true;
12}
13
14bool isPrimeRoot(int number)
15{
16 for (int i = 2; i <= sqrt(static_cast<float>(number)); i++)
17 if ((number % i) == 0)
18 return false;
19 return true;
20}
21
22int main()
23{
24 cout << "All primes between 2 and 1000 is: " << endl;
25 for (int number = 2; number <= 100000; number++)
26 {
27 if (isPrimeHalf(number))
28 cout << setw(8) << number;
29 }
30 cout << endl;
31 cout << "And now same with other function: " << endl;
32 for (int number = 2; number <= 100000; number++)
33 {
34 if (isPrimeHalf(number))
35 cout << setw(8) << number;
36 }
37 cout << endl;