Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.30 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement