#include <stdio.h>

int main()
{
    int num, rem, digit=0, j=1;
    
    printf("Enter the number in binary \n");
    scanf("%d", &num);
    
    while(num > 0){
        rem = num%10;
        digit += rem*j;
        j *= 2;
        num = num/10;
    }
    
    printf("Binary number in decimal format is %d", digit);
    return 0;
}

Output :

Leave a Reply

Your email address will not be published. Required fields are marked *