LCM Program in Java with Explanations

In this tutorial, we are going to learn java program to calculate the least common multiple of two numbers.

Our program will take two numbers as the input from the user and return the LCM of input numbers.

For example

if the user inputs the numbers 4 and 6. then the output should be ‘12’ as 12 is the LCM of 4 and 6.

Java Program to calculate LCM of two numbers


lcm program in java