Skip to content
Home » C Programs » C Program for LCM of Two Numbers Using Functions

C Program for LCM of Two Numbers Using Functions

Simple 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. By using this we have executed the c program for lcm of two numbers using functions

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

C Program to Find the Length of the String Using Pointers 

C Program for Sum and Average of n Numbers 

C Program to Check Armstrong Number Using For Loop 

C Program to Concatenate String Without Using Strcat 

Insertion Sort Program in C With Output 

Merge Sort in C Program With Output 

C Program to Find Area and Circumference of Circle Using Pointers 

C Program to Find Sum of All Prime Numbers From 1 to n 

C Program to Print Hello World 10 Times Using For Loop 

C Program to Count Number of Digits Using While Loop 

Binary releases – Code::Blocks

GDB online Debugger | Compiler – Code, Compile, Run, Debug online C, C++

Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc

C (programming language)

Applications of C Programming That Will Make You Fall In Love With C