Saturday 9 June 2012

C Program To Find LCM of Two Numbers

Posted by Unknown On 11:17 | No comments
#include<stdio.h>
void lcm();
int main(void)
{
lcm();
}
void lcm()
{
int a,b,i;
printf("enter the no:s");
scanf("%d%d",&a,&b);
for(i=2;i<=(a*b);i++)
{

if(((i%a)==0)&&((i%b)==0))
{
printf("the lcm is %d",i);

}
}
}

0 comments:

Post a Comment

Blogroll

Blogger templates

About