Tuesday 1 October 2013

c++ program to find LCM of given two numbers

#include<iostream.h>
#include<conio.h>
void main()
{
int u,v,t,l;
clrscr();
cout<<"enter any two integers";
cin>>u>>v;
l=(u*v);
while(v!=0)
{
t=u%v;
u=v;
v=t;
}
l=l/u;
cout<<"\n"<<"lcm of two numbers is:"<<l;
getch();
}

No comments:

Post a Comment