Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int a,b;
  4. int c;
  5. int a2=a;
  6. int b2=b;
  7. int main()
  8. {
  9. cout<<"a=";cin>>a;
  10. cout<<"b=";cin>>b;
  11. if(a<0){a=-1*a;}
  12. if(b<0){b=-1*b;}
  13. while ( (a!=0)&& (b!=0))
  14. {
  15. if (a>=b) { a=a-b;}
  16. else { b=b-a;}
  17. }
  18. if (a==0) c=b;
  19. else c=a;
  20. cout<<"cmmdc"<<c;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement