InfoTwist
Information at its best
Wednesday, June 2, 2010
LCM of Two Numbers- C Code
int lcm(int m, int n)
{
int q=1,i=2,a,b;
for(i=2; i<=m (or) i <= n; i++)
if( isprime(i))
{
a = i^a divides m such that a is maximum;
b = i^b divides n such that b is maximum;
q = q* i^max(a,b);
}
return q;
}
No comments:
Post a Comment
Newer Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment