Code for binary to decimal

I need it in another way but not sure if its correct or not