#include <stdio.h>

int a[5], i, c=1, b=0;

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(" ------> ");
    c=1; b=0;
    for(i=4; i>=0; i--) {
        b=b+a[i]*c;
        c=c*2;
    }
    printf("numero decimale = %d", b);
}

Embed on website

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