Advertisement
rotti321

T10 SIII ex1

May 17th, 2021
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int armonie(int x,int y){
  6.     int sum=x+y,sx=0,sy=0;
  7.     for(int i=1;i<=x;i++){
  8.         if(x%i==0){
  9.           sx=sx+i;  
  10.         }
  11.     }
  12.     for(int i=1;i<=y;i++){
  13.         if(y%i==0){
  14.             sy=sy+i;
  15.         }
  16.     }
  17.     if(sx>sy){
  18.         x=sx;
  19.         sx=sy;
  20.         sy=x;
  21.     }
  22.     if(sx<=sum && sum<=sy)
  23.         return 1;
  24.     else{
  25.         return 0;
  26.     }
  27. }
  28.  
  29. int main()
  30. {
  31.     int x,y;
  32.     cin>>x>>y;
  33.     cout<<armonie(x,y);
  34.    
  35.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement