i have following problem To decode the Biquinary code use the number 5043210. At each digit multiply the biquinary number by the number 5043210. This will give you one decimal digit. For example take the number 0110000. To change this into decimal: (5 × 0) + (0 × 1) + (4 × 1) + (3 × 0) + (2 × 0) + (1 × 0) + (0 × 0) = 4 i have tried this one
#include <iostream>
using namespace std;
int main(){
char a[]="5043210";
int sum=0;
int b=48;
int n=sizeof(a)/sizeof(char);
for (int i=0;i<n;i++){
sum+=(a[i]-'0')*(b>>(1<<(n-1-i)));
}
cout<<sum<<endl;
return 0;
}
but unfortunately it gives me wrong answer please help