Program:
// Program By http://solutionscpp.blogspot.com
// Author Mansoor Ahmed
// GMail ID: secguy000@gmail.com
#include <iostream>
using namespace std;
int main() {
int a=0, b=0, x=0, y=0, t=0, hcf=0, lcm=0;
cout<<"Enter 1st number: ";
cin>>x;
cout<<"Enter 2nd number: ";
cin>>y;
a = x;
b = y;
while (b != 0)
{
t = b;
b = a % b;
a = t;
}
hcf = a;
lcm = (x*y)/hcf;
cout<<"HCF is: " <<hcf <<endl;
cout<<"LCM is: " <<lcm <<endl;
return 0;
}
I found nice article in your blog.thank you for useful info
ReplyDelete.