Advertisement
Guest User

trimite fra

a guest
Dec 11th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. long long a, b;
  8. cout<<"a= "; cin>>a;
  9. cout<<"b= "; cin>>b;
  10. if (b)
  11. {
  12. while (a!=b)
  13. if (a>b)
  14. a=a-b;
  15. else
  16. b=b-a;
  17. }
  18. if (a==0)
  19. cout<<"cmmdc nu e definit.";
  20. else
  21. cout<<"cmmdc este "<<a;
  22. if (a==0 && b!=0)
  23. cout<<"cmmdc este "<<b;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement