Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find numbers expressible as sum of two primes (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 isPrime(int n) { int i;
if(n < 2) return 0;
for(i = 2; i * i <= n; i++)
if(n % i == 0) return 0;
return 1;
}
int main() {
int start, end, num, i;
printf("Enter range (start end): ");
scanf("%d %d", &start, &end);
printf("Numbers expressible as sum of two primes:\n");
for(num = start; num <= end; num++) {
if(num < 4) continue; // Smallest sum of two primes is 4 (2+2)
int found = 0;
for(i = 2; i <= num/2; i++) {
if(isPrime(i) && isPrime(num - i)) {
printf("%d = %d + %d\n", num, i, num - i);
found = 1;
break;
}
}
}
return 0;
}