C Programming
LCM
Learn C programming for find lowest common multiple of two positive interger
By Geekboots
6/7/2018
0 views
lcm.cC
#include<stdio.h>
int common_divisor(int, int);
int main() {
int a, b, gcd, lcm;
printf("Enter two positive number to find Lowest Common Multiple:\n");
scanf("%d %d",&a, &b);
gcd = common_divisor(a, b);
lcm = (a * b) / gcd;
printf("Lcm of two number is: %d\n",lcm);
return 0;
}
/* Recursive function */
int common_divisor(int x, int y) {
if(y == 0)
return x;
else
/* Call the common_divisor function inside in it */
common_divisor(y, x % y);
}
/* Output */
Enter two positive number to find Lowest Common Multiple:
30
20
Lcm of two number is: 60
C programmingC codingLowest common multiplelcm