Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find numbers divisible by all numbers from 1 to k (for loop) is an interactive C dry run visualizer from the Nested 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 main() {
int k, limit, num, i;
printf("Enter k: ");
scanf("%d", &k);
printf("Enter search limit: ");
scanf("%d", &limit);
printf("Numbers divisible by all numbers 1 to %d (up to %d):\n", k, limit);
for(num = 1; num <= limit; num++) {
int divisible = 1;
for(i = 1; i <= k; i++) {
if(num % i != 0) {
divisible = 0;
break;
}
}
if(divisible) printf("%d ", num);
}
return 0;
}