fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int ile;
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11. cin>> ile;
  12. int *tab;
  13. tab = new int [ile];
  14.  
  15. for(int i=0; i<ile; i++)
  16. {
  17. int liczba;
  18. cin>> liczba;
  19. tab[i]= liczba;
  20. }
  21.  
  22. for(int i=0; i<ile; i++)
  23. {
  24. if(tab[i]<2 )
  25. {
  26. cout<< "Nie"<<endl;
  27. }
  28. else{
  29. int t=0;
  30. int n=0;
  31.  
  32. for(int j=2; j*j<= tab[i];j++)
  33. {
  34. if(tab[i]%j==0)
  35. {
  36. n++;
  37.  
  38. }else
  39. {
  40. t++;
  41. }
  42. }
  43. if(n>=1)
  44. {
  45. cout<< "Nie"<<endl;
  46. }else
  47. {
  48. cout<< "Tak"<<endl;
  49. }
  50. }
  51.  
  52. }
  53.  
  54. delete [] tab;
  55. return 0;
  56.  
  57. }
  58.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty