Repeat pair processing until user exits (do-while) Dry Run in C

Repeat pair processing until user exits (do-while) 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.

Repeat pair processing until user exits (do-while) Program Code

#include <stdio.h>
int main() {
    int n, choice, i, j;
    
    do {
        printf("\n--- Pair Generator ---\n");
        printf("Enter n: ");
        scanf("%d", &n);
        
        printf("Pairs (i,j) for 1 to %d:\n", n);
        for(i = 1; i <= n; i++) {
            for(j = 1; j <= n; j++) {
                printf("(%d,%d) ", i, j);
            }
            printf("\n");
        }
        
        printf("\nPress 1 to continue, 0 to exit: ");
        scanf("%d", &choice);
        
    } while(choice == 1);
    
    printf("Thank you!\n");
    return 0;
}

View the complete Nested programs page.

Program Console Repeat pair processing until user exits (do-while) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.