Find LCM of Two Number:
#include<stdio.h>
#include<conio.h>
void main()
{
int i,num1,num2,max,LCM;
clrscr();
printf("Enter Any Two Numbers To Find LCM:- ");
scanf("%d%d",&num1,&num2);
max=(num1>num2)?num1:num2;
for(i=0;i<max;i++)
{
if(max%num1==0 && max%num2==0)
{
LCM=max;
break;
}
max++;
}
printf("\n LCM of The Two Number=%d",LCM);
getch();
}
Output:
EmoticonEmoticon