Lcm of two numbers in c using a for loop to execute the lcm numbers in c program for beginners to understand the concept for loop and its implementation method in c.

## LCM Definition

The H.C.F. is the largest factor present between two or more numbers, whereas the L.C.M. is the smallest number that is exactly divisible by two or more numbers.

The greatest common factor (GCF) is also referred to as the greatest common factor (HCF), while the least common divisor (LCM) is referred to as the least common divisor.

In arithmetic, the LCM value is useful when two things are paired against each other to optimize the quantities of the given objects.

## For Loop Definition in C

A for loop is a repetition control structure that lets you design a loop that needs to run a certain number of times quickly. In the C programming language, the for loop is used to iterate statements or parts of a program numerous times.

It is commonly used to traverse data structures such as an array and a linked list. A for-loop (or simply for loop) is a control flow statement in computer science that specifies iteration and allows code to be executed repeatedly.

## LCM of Two Numbers in C Using For Loop

```
#include<stdio.h>
int main()
{
int n1, n2, i, gcd, lcm;
printf("Enter Two Numbers");
scanf("%d %d", &n1, &n2);
for (i = 1; i <= n1 && i <= n2; ++i)
{
if (n1 % i == 0 && n2 % i == 0)
gcd = i;
}
lcm = (n1 * n2) / gcd;
printf("The LCM of Two Numbers is %d",lcm);
return 0;
}
```

Output:

Enter Two Numbers

45

67

The LCM of Two Numbers is 3015

Linear Search in C Program Using Array

Insertion Sort Program in C Using Array

Bubble Sort Program in C Using Function

Bubble Sort in C Program Example

Binary Search in C Program Using Function

Prime or Not in C Using Function

LCM of Two Numbers in C Using For Loop

LCM of Two Numbers in C Using Recursion