# include <stdio.h>
# include <conio.h>
int lcd (int x, int y);
void main ( )
{
int m, n, result;
clrscr ( );
printf(" Enter the two integers :");
scanf("%d%d",&m,&n);
result = lcd (m,n); //.. Function call
printf("%d",result);
getch();
}
int lcd (int x, int y)
{
int small,res;
int found;
if (x >y)
small = y; //.. load smaller of the two in small
else
small = x;
res = 2;
found = 0;
while ((found == 0) && (res<= small))
{
if ((x % res == 0) && (y % res == 0))
found = 1;
else
res++;
}
if (found == 1)
return (res);
else
return (1);
}