#include<stdio.h>
#include<iostream>
int bar(int m, int n){
if(m==0)return n;
if(n==0)return m;
return bar(n%m,m);
}
int foo(int m,int n){
return(m*n/bar(m,n));
}
int main(){
int x=foo(1000,1500);
printf("%d",x);
return 0;
}

You need not check for such large values just take m=10 and n=15. You will find that the value returned by bar(m,n) is 5.

m*n here is equal to 150 when you divide 150 by 5 you get 30 . you just need to add 2 additional zeros (m=10*100 and n=15*100)to get the result i.e., 3000