3.7 — Converting between binary and decimal « Learn C++
Another example Let’s convert 117 to binary using method 1: 117 / 2 = 58 r1 58 / 2 = 29 r0 29 / 2 = 14 r1 14 / 2 = 7 r0 7 / 2 = 3 r1 3 / 2 = 1 r1 1 / 2 = 0 r1 Constructing the number from the remainders from the bottom up, 117 = 111 0101 binary And using ...