Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. bool pierwsza(int a)
  5. {
  6.  if (a<=1) return 0;
  7.  for (int i=2;i<a-1;i++)
  8.    if (a%i==0)  return 0;
  9.    return 1;
  10. }
  11.  
  12. int main()
  13. {
  14.     int a;
  15.     cin >> a;
  16.     int x;
  17.  
  18.     for(int i=0;i<a;i++)
  19.     {
  20.         cin >> x;
  21.         if (pierwsza(x)) cout <<"TAK"<<endl;
  22.         else cout <<"NIE"<<endl;
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement