skip to main
|
skip to sidebar
De Archer
Pages
Home
Friday, November 5, 2010
LCM of two numbers in C / C++
/* 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;
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
About Me
Unknown
View my complete profile
No comments:
Post a Comment