Next question on the same assignment: find the LCM of two integers, being careful about overflow for large inputs. Read two positive integers A and B. Print their LCM. Be careful of overflow — use LCM = A/GCD(A,B)*B, and use long long / a wider type in C.
Input
Two integers A B.
Output
LCM(A,B).
Constraints
1 ≤ A,B ≤ 10^6
Sample Input
4 6
Sample Output
12
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.