Advertisement
Guest User

Untitled

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