Binary to Decimal conversion -Bitwise Left shift Operator
Binary to decimal conversion using Bitwise Left-shift Operator - algorithm Declaration Input Read char bits[9] Output integer decval Temp var integer n=0,len=0 len = strlen(bits) Loop n=0 to len-1 decval left shift by 1 bits[n] == '1' then decval OR by 1 decval left shift by 1 End Loop Output print,bits Binary to Decimal conversion by Left-shift -C programming code The C programming code converts binary bits into a decimal value by bitwise left-shift operator. The input binary bits are given to the program while it is running and returns a decimal value as conversion result. # include <stdio.h> # include < string .h> int main () { int decval; char bits[9]; int n=0; printf ("\n Bitwise Left-shift Operat or Decimal Conversion"); printf("\n Enter a binary bits :" ); scanf("%s", &bits); ...