Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find perfect numbers in a range (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 start, end, num, i;
printf("Enter range (start end): ");
scanf("%d %d", &start, &end);
printf("Perfect numbers between %d and %d:\n", start, end);
int found = 0;
for(num = start; num <= end; num++) {
int sum = 0;
// Find proper divisors (exclude the number itself)
for(i = 1; i <= num/2; i++) {
if(num % i == 0) {
sum += i;
}
}
if(sum == num && num > 0) {
printf("%d ", num);
found++;
}
}
if(found == 0) printf("None found");
printf("\nTotal perfect numbers: %d\n", found);
return 0;
}