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