SHARE
TWEET

Untitled

a guest Dec 5th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. int a,sa,b,sb,d;
  4.  
  5. int main(void)
  6. {
  7. cout<<"a=";
  8. cin>>a;
  9. cout<<"b=";
  10. cin>>b;
  11. sa=1;
  12. for(d=2;d<=a/2;d++)
  13. if(a%d==0)
  14. sa=sa+d;
  15.  
  16. if(sa==b)
  17. {
  18. sb=1;
  19. for(d=2;d<=b/2;d++)
  20. if(b%d==0)
  21. sb=sb+d;
  22.  
  23. if(sb==a)
  24. cout<<"Prietene";
  25. }
  26. else
  27. cout<<"Nu sunt prietene";
  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