Least Common Multiple
Easyjavapythonccppjavascript
Given two positive integers, find their least common multiple (LCM) — the smallest positive integer divisible by both.
Input Format
A single line containing two integers A and B.
Output Format
Print the LCM of A and B.
Example 1
Input
12 18
Output
36
Explanation: 36 is divisible by both 12 and 18, and no smaller positive common multiple exists.
- 1 <= A, B <= 1000000
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Check Prime NumberEasy · java, python, c, cpp, javascriptSolve Problem
- Greatest Common DivisorEasy · java, python, c, cpp, javascriptSolve Problem
- Count Digits and Digit SumEasy · java, python, c, cpp, javascriptSolve Problem