# How to Find LCM Number using Formula in Python

In this tutorial, we will create a "How to Find LCM Number using Formula in Python". The purpose of this tutorial is to educate you of finding the LCM number. We will try to understand the structure of the program for processing the LCM. I will provide a sample program to demonstrate the actual coding of this tutorial.

This tutorial is simple and easy to understand; just follow the instructions I provide, and you can also do it yourself with ease. The program will calculate the LCM of the number you have provided. I will do my best to provide you with the most simplified method of creating this program, called "Find LCM Number". So, let's start with the coding.

## Creating Main Function

This is the main function of the application. The following code will display the find LCD number. To do this, simply copy and paste these blocks of code into the IDLE text editor.
`while True:   print("\n\n========== How to Find LCM Number in Python ==========\n")   ret=False    num1 = int(input("Enter the 1st number: "))   num2 = int(input("Enter the 2nd number: "))     def compute_gcd(x, y):       while(y):          x, y = y, x % y      return x    def compute_lcm(x, y):      lcm = (x*y)//compute_gcd(x,y)      return lcm    print("The L.C.M. is", compute_lcm(num1, num2))     user_input=input("\n\nTry again? (Yes/No): ")   print("\n\n")   if user_input.lower()=='no':      print("Exit program.")      break    elif user_input.lower()=='yes':      ret=True    else:      print("Wrong input.")      ret=True     if ret:      continue  `

In the code that I provided, we created a formula to obtain the GCD first so that it will be easier to calculate the LCM later on. To get the LCM, we multiply first the x and y and then divide the result by the GCD number. Lastly, to obtain the result, we append the number in the function to display it.

Following that, we use another while loop to check if the number is zero, and after that, we incorporate several lines of code to calculate the Armstrong number.