SHARE
TWEET

Untitled

a guest Dec 5th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int k,n,x,sd1,sd2,d;
  7.     k=0;
  8.     x=2;
  9. cin>>n;
  10.     while(k<n)
  11.     {
  12.         sd1=0;
  13.         for(d=1;d<=x/2;d++)
  14.             if(x%d==0) sd1=sd1+d;
  15.         sd2=0;
  16.         for(d=1;d<=sd1/2;d++)
  17.             if(sd1%d==0) sd2=sd2+d;
  18.         if(sd2==x && x<sd1)
  19.             { cout<<x<<" "<<sd1<<endl;
  20.                      k++;
  21.             }
  22.         x++;
  23.     }
  24.     return 0;
  25. }
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