the variable lcm is not defined


bharath rajsingh <[EMAIL PROTECTED]> wrote:


hi 2 all
here is a simple program in c .find the error in this program.
this is a program 2 find lcm for 2 nos.the concept i have used is

lcm = product of 2 nos./gcd
#include<stdio.h>
#include<conio.h>
main()
{
long int a,b,x,y;
printf("enter 2 nos\n");
scanf("%d %d",&a,&b);
x=a;
y=b;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
lcm=(x*y)/a;
printf("the lcm is%d",lcm);
}
in this prog. if i give small values i get the result.if i give the values like 200 & 250 im not getting the result.why is it so?
please debug the error here.

take care 
bye
BHARATH..


Discover Yahoo!
Have fun online with music videos, cool games, IM & more. Check it out!

Yahoo! Groups Links

Reply via email to