Program Console Vignaankosh.com
Execution Panel
Console is empty.
Display all pairs of prime 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 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, p, q;
printf("Enter range (start end): ");
scanf("%d %d", &start, &end);
printf("All prime pairs (p,q) with p ≤ q in range:\n");
for(p = start; p <= end; p++) {
if(!isPrime(p)) continue;
for(q = p; q <= end; q++) { // q starts from p to avoid duplicates
if(isPrime(q)) {
printf("(%d,%d) ", p, q);
}
}
printf("\n");
}
return 0;
}