Gcd ,Lcm
View Code
int gcd(int x,int y) { int tmp; while(y) { tmp=y; y=x%y; x=tmp; } return x; } int lcm(int a,int b) { return a/gcd(a,b)*b; }