binary

I'm having a lot of trouble doing this hw I was given.

it states: Input an integer containing only 0s and 1s (ex: a "binary" integer) and print its decimal equivalent. Use the modulus and division operators to pick off the "binary" numbers digits one at a time from right to left. Much as in the decimal number system, where the rightmost digit has a positional value of 1, the next digit left has a positional value of 1, the next digit left has a positional value of 10, then 100, then 1000, and so on in the binary number system the rightmost digit has a positional value of 1 the next digit has a positional value of 2, then 4, then 8, and so on. Thus the decimal number 234 can be interpreted as 2*100+3*10+4*1.
I don't see a question. What specific trouble are you having?
i dont rly know how to set it up idk if im suppose to use float, switch, char, etc...the teacher doesn't rly explain how to use this program at all.
Topic archived. No new replies allowed.