Friday, April 22, 2022

LCM OF TWO NUMBERS

 #include <iostream>

using namespace std;
int main()
{
    int num1, num2;
    int max;
    cout << "enter num1\n";
    cin >> num1;
    cout << "enter num2\n";
    cin >> num2;
    max = num1 > num2 ? num1 : num2;
    while (true)
    {
        if (max % num1 == 0 && max % num2 == 0)
        {
            cout << "lcm is " << max << endl;
            break;
        }
        max++;
    }

    return 0;
}

No comments:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts