Binary to decimal conversion Dry Run in C

Binary to decimal 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.

Binary to decimal conversion Program Code

#include <stdio.h>
int main() {
    long long binary;
    int decimal = 0, base = 1;
    
    printf("Enter binary number: ");
    scanf("%lld", &binary);
    
    while(binary > 0) {
        int lastDigit = binary % 10;
        decimal = decimal + lastDigit * base;
        base = base * 2;
        binary = binary / 10;
    }
    
    printf("Decimal: %d\n", decimal);
    return 0;
}

View the complete While programs page.

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