Two of my friends faced a problem with writing a program which finds the

So here are the functions:

**LCM**(Lowest Common Multiple)/**GCD**(Greatest Common Divisor) of two positive integers, so I helped them out by writing two functions for each. I thought many others might be having the same problem.So here are the functions:

**For LCM:**Code:

/* a & b are the numbers whose LCM is to be found */ int lcm(int a,int b) { int n; for(n=1;;n++) { if(n%a == 0 && n%b == 0) return n; } }

**For GCD:**Code:

/* a & b are the numbers whose GCD is to be found. Given a > b */ int gcd(int a,int b) { int c; while(1) { c = a%b; if(c==0) return b; a = b; b = c; } }