Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main ()
- {
- int a,b;
- cin >> a >> b;
- //GCD : Greatest Common Divisor
- cout << __gcd(a , b) << endl;//12
- //LCM : Least Common Divisor
- int lcm = (a* (b/__gcd(a,b) ) );
- cout << lcm << endl;//24
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement