#include<stdlib.h>
#include<stdio.h>
#include<math.h>
int main()
{
int bin, dec = 0, i;
printf("\nEnter A Binary Number: \t"); for(i = 0; bin > 0; i++)
{
dec
= dec
+ pow(2, i
) * (bin
% 10); bin = bin / 10;
}
printf("\nDecimal Equivalent of Binary Number: \t %d\n", dec
); return 0;
}
I2luY2x1ZGU8c3RkbGliLmg+CiNpbmNsdWRlPHN0ZGlvLmg+CiNpbmNsdWRlPG1hdGguaD4KCmludCBtYWluKCkKewogICAgaW50IGJpbiwgZGVjID0gMCwgaTsKICAgIHByaW50ZigiXG5FbnRlciBBIEJpbmFyeSBOdW1iZXI6IFx0Iik7CiAgICBzY2FuZigiJWQiLCAmYmluKTsKICAgIGZvcihpID0gMDsgYmluID4gMDsgaSsrKQogICAgewogICAgICAgIGRlYyA9IGRlYyArIHBvdygyLCBpKSAqIChiaW4gJSAxMCk7CiAgICAgICAgYmluID0gYmluIC8gMTA7CiAgICB9CiAgICBwcmludGYoIlxuRGVjaW1hbCBFcXVpdmFsZW50IG9mIEJpbmFyeSBOdW1iZXI6IFx0ICVkXG4iLCBkZWMpOwogICAgcmV0dXJuIDA7Cn0=