Advertisement
denis_andrei10

verifinrprim

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