Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int cmmdc(int a , int b)
- { while (a!=b)
- if(a>b)
- a=a-b;
- else b=b-a;
- return a;
- }
- int main()
- {
- int x , y;
- cout<<"primul nr: "; cin>>x;
- cout<<"al doilea nr: "; cin>>y;
- cout<<"cmmdc este: "<<cmmdc(x,y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement