Advertisement
vladm98

Untitled

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