fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. bool czy_pierwsza(int n)
  5. {
  6. if(n<2)
  7. return false;
  8. for(int i=2; i*i<=n; i++)
  9. if(n%i==0)
  10. return false;
  11. return true;
  12. }
  13. int main()
  14.  
  15. {
  16. int l_testow;
  17. cin>>l_testow;
  18. if(l_testow>=100000)
  19. return 0;
  20. else if(l_testow<10000)
  21. {
  22. for(int i=1; i<=l_testow; i++)
  23. if(czy_pierwsza(i)==false)
  24. cout<<i<<" NIE"<<endl;
  25. else if(czy_pierwsza(i)==true)
  26. cout<<i<<" TAK"<<endl;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty