#include< stdio.h >
#include< conio.h >
void main()
{
int num1,num2,lcm;
clrscr();
printf("Enter two numbers:");
scanf("%d\t %d",&num1,&num2);
if (num1>num2)
lcm=num1;
else
lcm=num2;
while(lcm%num1!=0 || lcm%num2!=0)
{
lcm++;
}
printf("LCM= %d",lcm);
getch();
}
OUTPUT :
Enter two numbers: 2 4
LCM=2
#include< conio.h >
void main()
{
int num1,num2,lcm;
clrscr();
printf("Enter two numbers:");
scanf("%d\t %d",&num1,&num2);
if (num1>num2)
lcm=num1;
else
lcm=num2;
while(lcm%num1!=0 || lcm%num2!=0)
{
lcm++;
}
printf("LCM= %d",lcm);
getch();
}
OUTPUT :
Enter two numbers: 2 4
LCM=2
No comments :
Post a Comment