Finding LCM using GCD is explained here but here the task is to find LCM without first calculating GCD.
Input: 7, 5 Output: 35 Input: 2, 6 Output: 6
The approach is to start with the largest of the 2 numbers and keep incrementing the larger number by itself till smaller number perfectly divides the resultant.
LCM of 5 and 7 is 35
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to find GCD or HCF of two numbers
- Program to find LCM of two numbers
- Program to find LCM of two Fibonnaci Numbers
- Program to find sum of prime numbers between 1 to n
- Program to find sum of first n natural numbers
- Program to find first N Fermat Numbers
- Program to find first N Iccanobif Numbers
- C program to Find the Largest Number Among Three Numbers
- Program to find the percentage of difference between two numbers
- Program to find the common ratio of three numbers
- Program to find GCD of floating point numbers
- Program to find if two numbers and their AM and HM are present in an array using STL
- Program to find HCF (Highest Common Factor) of 2 Numbers
- Program to find the maximum difference between the index of any two different numbers
- Program to find GCD or HCF of two numbers using Middle School Procedure
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.