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

Popular posts from this blog

Multiple inheritance,friend function and multiple file in oop(object oriented programming)

Concepts of OOP (object oriented programming)

Concepts in c++........