Wednesday, 24 June 2015

LCM

/*

Tanzila Islam

CSE, Southeast University.

Dhaka-Bangladesh.

id : https://www.facebook.com/prieontypurnotamohita

mail: tanzilamohita@gmail.com

blog: http://tanzilamohita.blogspot.com/


*/


#include <iostream>

using namespace std;


int main()

{

    int x,y,gcd=1;

        cout << "Enter numbers :" << endl;

        cin >> x >> y;

for (int i=1; i<1000; i++)

{

    if ((x%i==0) && (y%i==0))

        gcd =i;

}

cout << "LCM :" << ((x*y)/gcd) << endl;

return 0;

}

No comments:

Post a Comment