Least Common Multiply:
LCM of two integers is a smallest positive integer which is multiple of both integers that it is divisible by the both of the numbers example: LCM of two numbers 9 and 6 is 18.Program:
//C Program to find LCM of two numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z,i;
clrscr();
printf("Enter Two Numbers = ");
scanf("d%d",&x,&y);
for(i=1;i<=x*y*z;i++)
{
if(i%x==0&&i%y==0)
{
printf("LCM is %d\n",i);
break;
}
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,z,i;
clrscr();
printf("Enter Two Numbers = ");
scanf("d%d",&x,&y);
for(i=1;i<=x*y*z;i++)
{
if(i%x==0&&i%y==0)
{
printf("LCM is %d\n",i);
break;
}
}
getch();
}
0 comments