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