Monday, May 23, 2016

How to find LCM of two numbers in C Language

Find LCM of two numbers in C Language

C Program for LCM of Two Numbers:


#include<stdio.h>
void main()
{
int x, y, LCM;
x = 4; y = 9; LCM =1;

for(;;)
{
if(LCM % x != 0 || LCM % y != 0)
++LCM;
else
break;
}

printf("LCM of x and y is = %d", LCM);
}

No comments:

Post a Comment