Program to find the l.c.m of two numbers in c++
#include<iostream>
using namespace std;
int main()
{
int a, b,l;
cout << "Enter the value of a and b:";
cin >> a >> b;
for (l = 1; l <= a*b; l++)
{
if (l % a == 0 && l % b == 0)
break;
}
cout << " LCM is" << l;
getchar();
getchar();
return 0;
}
Comments
Post a Comment