## Problem statement:

**What is LCM of numbers**

LCM is a least common factor of given two numbers

Given: input1 = 4 and input2 = 5

then answer is LCM = 20

### Write a C program to find LCM of numbers

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include<stdio.h> int main() { int n1, n2, t1, t2; printf("Enter n1 and n2 : "); scanf("%d %d", &n1, &n2); t1 = n1; t2 = n2; if(n1 > n2) { for(; n1%n2!=0; n1=n1+t1){} printf("LCM is %d",n1); } if(n2 > n1) { for(; n2%n1!=0; n2=n2+t2){} printf("LCM is %d",n2); } getch(); } |

**Output**

1 2 |
Enter n1 and n2 : 2 3 LCM is 6 |