Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find largest digit in a number (Recursion) 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>
int largestDigit(int n) {
// BASE CASE: single digit, return itself
if(n < 10) {
return n;
}
int lastDigit = n % 10;
int maxInRest = largestDigit(n / 10);
// Return the larger of lastDigit and max from remaining
return (lastDigit > maxInRest) ? lastDigit : maxInRest;
}
int main() {
int num = 739582;
int result = largestDigit(num);
printf("Number: %d\n", num);
printf("Largest digit = %d\n", result);
return 0;
}