#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,i,j,flag=0,t;
printf("Enter two number:-");
scanf("%d%d",&a,&b);
if(a<0)
a=-a;
if(b<0)
b=-b;
if(a>b)
{
t=a;
a=b;
b=t;
}
if((a==0)||(b==0))
printf("is not possible:-\n");
else
{
for(i=1;i<=a;i++)
{
for(j=1;j<=b;j++)
{
if((a*j)==(b*i))
{
flag=1;
break;
}
}
if(flag==1)
break;
}
printf("The LCD is=%d",b*i);
}
getch();
}
No comments:
Post a Comment