Your Ad Here

Saturday, September 13, 2008

LCM and HCM of two numbers

/* C++ program to calculate LCM and HCM of two numbers */
#include< stdio.h>
#include< conio.h>
void main()
{
int a,b,c;
cout< < "Enter two nos : ;
cin>>a>>b;
c=a*b;
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
cout< < "HCM \t= " < < a;
cout< < "LCM \t= " < < c/a;
getch();
}
Your Ad Here