SHARE
TWEET

Untitled

a guest Nov 13th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n,d=2,s=0,x;
  6.  
  7. int main()
  8. {
  9.     int i;
  10.     cin>>n;
  11.     for(i=1;i<=n;i++)
  12.     {
  13.         cin>>x;
  14.         d=2;
  15.         while(d<=x)
  16.         {
  17.             if(x%d==0)
  18.             {
  19.                 s=s+d;
  20.                 d = x+1;///opresc while-ul
  21.             }
  22.             else
  23.                 d++;
  24.         }
  25.     }
  26.     cout<<s;
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top