Program Console Vignaankosh.com
Execution Panel
Console is empty.
LCM using recursion (via GCD) is an interactive C dry run visualizer from the Recursion programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.
This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.
#include <stdio.h>
// Euclid's algorithm for GCD using recursion
int gcd(int a, int b) {
if(b == 0) {
return a;
}
int remainder = a % b;
int gcdValue = gcd(b, remainder);
return gcdValue;
}
// LCM = (a * b) / GCD(a, b)
int lcm(int a, int b) {
int gcdValue = gcd(a, b);
int lcmValue = (a * b) / gcdValue;
return lcmValue;
}
int main() {
int x = 12, y = 18;
int result = lcm(x, y);
printf("LCM of %d and %d = %d\n", x, y, result);
return 0;
}