Decimal to binary conversion Dry Run in C

Decimal to binary conversion is an interactive C dry run visualizer from the While 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.

Decimal to binary conversion Program Code

#include <stdio.h>
int main() {
    int num, binary[32], i = 0;
    
    printf("Enter decimal number: ");
    scanf("%d", &num);
    
    while(num > 0) {
        binary[i] = num % 2;
        num = num / 2;
        i++;
    }
    
    printf("Binary: ");
    for(int j = i-1; j >= 0; j--)
        printf("%d", binary[j]);
    
    return 0;
}

View the complete While programs page.

Program Console Decimal to binary conversion Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.