#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll gcd(ll n, ll m){
if(m==0)return n;
else return gcd(m,m%n);
}
int main() {
ll n,m;
cin>>n>>m;
cout<<(n*m)/gcd(n,m);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll gcd(ll n, ll m){
if(m==0)return n;
else return gcd(m,m%n);
}
int main() {
ll n,m;
cin>>n>>m;
cout<<(n*m)/gcd(n,m);
return 0;
}
hello @talhashamim001
in ur gcd function take care of cases n>m or m>n .
or simply use inbuilt __gcd(a,b) function;
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.