fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. bool p=true;
  8. int x, n; //n to liczba testow, a x to kolejne liczby do sprawdzenia
  9. cout << endl;
  10. cin >> n;
  11. for(int j=1; j<=n; j++)
  12. {
  13. cout<<endl;
  14. cin>>x;
  15. if(x==1) cout<<"NIE"<<endl;
  16. if(x==2) p=true;
  17. for(int i=2; i<x; i++)
  18. {
  19. if(x%i==0)
  20. {
  21. p=false;
  22. cout<< "NIE" <<endl;
  23. break;
  24. }
  25. }
  26. if(p && x!=1) cout<<"TAK"<<endl;
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 4304KB
stdin
3
11
1
4
stdout

TAK

NIE

NIE