Advertisement
Guest User

numere10

a guest
Sep 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,x, pmax=-1, pmin=99999, c, nr=0;
  8. cin >> n;
  9. for(int i=1; i<=n; ++i)
  10. {
  11. cin >> x;
  12. c=0;
  13. for(int j=2; j<=x; ++j)
  14. if(x%j==0)
  15. c++;
  16. if(c==2)
  17. {
  18. nr++;
  19. if(x>pmax)
  20. pmax=x;
  21. if(x<pmin)
  22. pmin=i;
  23. }
  24. }
  25. cout << nr << " " << pmin << " " << pmax;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement