Advertisement
Guest User

Untitled

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