Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool liczba(int n)
  5. {
  6. if(n < 2)
  7. return false;
  8.  
  9. for(int i = 2; i * i <= n; ++i)
  10. {
  11. if( n % i == 0)
  12. return false;
  13. else
  14. return true;
  15. }
  16. }
  17.  
  18. int main()
  19. {
  20. int n, d;
  21.  
  22. cin >> d;
  23.  
  24. for (int i = 0; i < d; ++i)
  25. {
  26.  
  27. cin>>n;
  28.  
  29. if( liczba(n) == 1)
  30. cout << "PIERWSZA";
  31. else
  32. cout << "ZLOZONA";
  33.  
  34. }
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement