Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /**
- Se citesc doua numere naturale a,b.
- a)Sa se afiseze cel mai mare divizor comun al lor.
- b)Sa se afiseze cel mai mic multiplu comun al lor.
- */
- int main()
- {
- int a,b,r, A, B;
- cin>>a>>b;
- A = a;
- B = b;
- r = a%b;
- while(r)
- {
- a = b;
- b = r;
- r = a%b;
- }
- ///acum, cmmdc se va afla in b
- cout<<b<<"\n";
- cout<<(A*B)/b<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement