I am new at this!!!

I am trying to write a program that converts binary to decimal. My thought is to manipulate the power of 2 with a counter starting at zero. Then use the power function to get the power of 2. Each time that answer needs to be multiplied by a particular number in the binary number. How do I specify that number.?

ls