Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool funkcja(int n)
  6. {
  7.     int i = 2;
  8.     if(i>=n)
  9.     {
  10.         return true;
  11.     }
  12.     else if(n%i==0)
  13.     {
  14.         return false;
  15.     }
  16.     else
  17.     {
  18.         for(int x=0;x<n-2;x++)
  19.         {
  20.             i=i+1;
  21.             if(i>=n)
  22.             {
  23.                 return true;
  24.             }
  25.             else if(n%i==0)
  26.             {
  27.                 return false;
  28.             }
  29.         }
  30.     }
  31. }
  32.  
  33. int main()
  34. {
  35.     cout<<"Hello World"<<endl;
  36.     cout<<funkcja(47);
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement