Advertisement
cupsamada

cate sunt prime

Nov 25th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. int n, x, d, i, r, diviz=0, cate=0;
  7. cin>>n;
  8. for(i=1; i<=n; i++)
  9. {
  10. r=0;
  11. cin>>x;
  12. r=sqrt(x);
  13. for(d=2; d<=r; d++)
  14. {
  15. if(x%d==0)
  16. {
  17. diviz++;
  18. break;
  19. }
  20. }
  21. if(diviz==0)
  22. {
  23. cate++;
  24. }
  25. diviz=0;
  26. }
  27. cout<<cate;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement