fork(3) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int test, liczba, spraw;
  8. cin >> test;
  9. for (int i=1; i<=test; i++)
  10. {
  11. cin >> liczba;
  12. if (liczba<=2)
  13. spraw = 0;
  14. else if(liczba>2)
  15. {
  16. for (int b=2; b*b<=liczba; b++)
  17. {
  18. if(liczba%b==0)
  19. spraw = 0;
  20. else spraw = 1;
  21. }
  22. }
  23. if (spraw==0)
  24. cout << "NIE" << endl;
  25. else
  26. cout << "TAK" << endl;
  27.  
  28. }
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 16064KB
stdin
3
11
1
4
stdout
TAK
NIE
NIE