int a, b,max,min,_max,lcm,r;
cout << "Enter number {a b} : ";
cin >> a >> b;
if (a > b)
{
max = a;
min = b;
}
else
{
max = b;
min = a;
}
_max = max;
r = max%min;
while (r != 0)
{
max = max + _max;
r = max%min;
}
lcm = max;
cout <<"L.C.M ("<<a<<","<<b<<") = " <<lcm<< endl;
ไม่มีความคิดเห็น:
แสดงความคิดเห็น