#include <stdio.h>

int a[5], i, x, y;

int main() {
    for(i=0; i<5; i++) {
        scanf("%d", &a[i]);
    }
    printf("numero binario = ");
    for(i=0; i<5; i++) {
        printf("%d", a[i]);
    }
    printf("-----> ");
    x=1; y=0;
    for(i=4; i>=0; i--) {
        y=y+a[i]*x;
        x=x*2;   
    }
    printf("numero decimale = %d", y);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: