ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

C Program Source Code To Find LCM of two integers

Updated on December 12, 2017

Find LCM of two integers using C Program

LCM is the short form of Least or lowest Common Multiple. It is sometimes also called as Smallest Common multiple. LCM of two integers a and b denoted by LCM(a,b) is the smallest positive integer being multiple of both the a and b integers.

Let us find the LCM of two integers 9 and 3. To find out the LCM , we need to find the Smallest common multiple which will be multiple of both the integers i.e 9 and 3.

Multiples of 9 are : 9,18,27,36,45,54,63,72,81,90.

Multiples of 3 are : 3,6,9,12,15,18,21,24,27,30.

So by looking up the multiples, we find 9 as the least common multiple which is divisible by both of the integers.

This program will help you find the LCM of 2 digits easily. Just copy paste the source code provided in your Compiler and run it.

Source Code of C Program to Fine LCM of two integers

int main()
int a,b,i;
printf("\nEnter two numbers: ");
if(i%a==0 && i%b==0)
printf("\nLCM of %d and %d is : %d",a,b,i);
return 0;


    0 of 8192 characters used
    Post Comment

    No comments yet.