Advertisement
STANAANDREY

PB

Nov 28th, 2018
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   int a,b,c,cb,ca,cc;
  8.  
  9.   cin>>a>>b;
  10. c=b;
  11.   while (a!=0&&b!=0&&c!=0)
  12.   {
  13.       ca=a;
  14.      // cb=b;
  15.  
  16.       cin>>c;
  17.       cc=c;
  18.       if (cc==0)
  19.         break;
  20.      // cc=c;
  21.       while (a!=c)
  22.       {
  23.           if (a>c)
  24.             a-=c;
  25.           else
  26.             c-=a;
  27.       }
  28.       if (b==c)
  29.         cout<<ca<<" "<<b<<" "<<cc;
  30.       a=b;
  31.       b=cc;
  32.  
  33.  
  34.   }
  35.  
  36.  
  37.    return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement