C Program for LCM of Two Numbers Using Functions

C Program for LCM of Two Numbers Using Functions. In this program, we can find the lcm of two numbers using functions for beginners to understand and implement the lcm program in c.

Function Definition in C

A function is a collection of statements that work together to complete a task. 

Every C program contains at least one function, main(), and even the simplest programs can specify more functions. 

The name, return type, and parameters of a function are all specified in a function declaration. 

A function is a logical unit of code that is frequently defined by its place in a larger code structure. 

A function is a unit of code that works on a variety of inputs, many of which are variables, and provides real outcomes such as changing variable values or doing actual operations based on the inputs. 

If Else Statement in C Program

In C, the if-else statement is used to carry out operations based on a set of conditions. 

If and only if the supplied condition is true, the operations stated in the if block are executed. A program will either run the true code block or do nothing if the if statement is used. 

The program will always run anything using an if/else statement since it will either execute the true code block or the false code block.

C Program for LCM of Two Numbers Using Functions

#include <stdio.h> 
#include <conio.h> 
int func( int a, int b); 
int main() 
int n1, n2, lcm; 
printf ("Enter The Number"); 
scanf ("%d %d", &n1, &n2); 
printf ("LCM of %d and %d is %d", n1, n2, lcm); 
return 0; 
int func (int n1,int n2) 
static int max = 1; 
return max; 
func( n1, n2); 
return max; 

Enter The Number
LCM of 4 and 45 is 180