Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert binary to decimal

Tags:

c#

.net

How can I convert a binary string, such as 1001101 to Decimal? (77)

like image 397
Gold Avatar asked Dec 25 '09 17:12

Gold


People also ask

How do you convert 1111 binary to decimal?

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.

How do you convert 1101 binary to decimal?

This will give the binary equivalent of 1101. Therefore, the binary equivalent of decimal number 1101 is 10001001101.


1 Answers

The Convert.ToInt32 method has an overload that accepts a base parameter.

Convert.ToInt32("1001101", 2).ToString(); 
like image 196
SLaks Avatar answered Sep 22 '22 07:09

SLaks