Previous Next
0 / 18
Module DEMO-32-90DEMO-C-32

LCM Calculator

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a function int lcm(int a, int b) that returns the Least Common Multiple of two positive integers.

Constraints

1

Input Format

Two positive integers.

Output Format

The LCM value.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
4 6
12
LCM of 4 and 6 is 12.
Sample #2
Public sample
3 5
15
LCM of 3 and 5 is 15.
Sample #3
Public sample
1 5
5
LCM is 5.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings