Sie sind auf Seite 1von 1

#include<stdio.

h>
#include<conio.h>
int a,b,max=0,min=0,lcm=1,i;
void main()
{clrscr();
printf("enter the first number:");
scanf("%d",&a);
printf("\nenter the second number:");
scanf("%d",&b);
if(a>b)
{
max=a;
min=b;
}
else if(b>a){
max=b;
min=a;
}
else
printf("\nlcm of two numbers is:%d",a);
for(i=1;i<=min;i++)
{
int x=max*i;
if(x%min==0)
{
lcm=x;
break;
}
}
printf("\nlcm of two numbers is:%d",lcm);
getch();
}

Das könnte Ihnen auch gefallen