Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. bool pierwsza(int x)
  6. {
  7.     if(x<2) return false;
  8.     for(int i=2; i <= sqrt(x); i++)
  9.         if(x%i==0) return false;
  10.     return true;
  11. }
  12. int main()
  13. {
  14.     int n;
  15.     cin>>n;
  16.     for(int i = 0; i<n; i++)
  17.     {
  18.         int x;
  19.         cin>>x;
  20.         if(pierwsza(x))
  21.         {
  22.             cout<<"TAK\n";
  23.         }
  24.         else
  25.         {
  26.          cout<<"NIE\n";
  27.         }
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement