How can I convert a binary string, such as 1001101
to Decimal? (77)
1111 in binary is 10001010111. To find decimal to binary equivalent, divide 1111 successively by 2 until the quotient becomes 0. The binary equivalent can be obtained by writing the remainder in each division step from the bottom to the top.
This will give the binary equivalent of 1101. Therefore, the binary equivalent of decimal number 1101 is 10001001101.
The Convert.ToInt32
method has an overload that accepts a base parameter.
Convert.ToInt32("1001101", 2).ToString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With