C Programming Code Examples C > Mathematics Code Examples Program to Find LCM of a Number using Recursion Program to Find LCM of a Number using Recursion The following C program, using recursion, finds the LCM. An LCM is the lowest common multiple of any 2 numbers. #include <stdio.h> int lcm(int, int); int main() { int x, y, result; int prime[100]; printf("Enter two numbers: "); scanf("%d%d", &x, &y); result = lcm(x, y); printf("The LCM of %d and %d is %d\n", x, y, result); return 0; } int lcm(int x, int y) { static int common = 1; if (common % x == 0 && common % y == 0) { return common; } common++; lcm(x, y); return common; }