Advertisement
MeehoweCK

Untitled

Apr 22nd, 2021
640
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool czy_pierwsza(int n)
  6. {
  7.     if(n < 2)
  8.         return false;
  9.     for(int i = 2; i*i <= n; ++i)
  10.         if(n % i == 0)
  11.             return false;
  12.     return true;
  13. }
  14.  
  15. int main()
  16. {
  17.     cout << czy_pierwsza(1237) << endl;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement