Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int cmmdc(int a , int b)
  5. { while (a!=b)
  6. if(a>b)
  7. a=a-b;
  8. else b=b-a;
  9. return a;
  10.  
  11. }
  12.  
  13. int main()
  14. {
  15. int x , y;
  16. cout<<"primul nr: "; cin>>x;
  17. cout<<"al doilea nr: "; cin>>y;
  18. cout<<"cmmdc este: "<<cmmdc(x,y);
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement