I don't know why I always forget the method of base conversion after a period of time
I don't know why
Take a look at this knowledge recently , And think about the principle

Binary to decimal
example :
Binary number 1001B=1*2^0 + 0*2^1 + 0*2^2  + 1*2^3=1 + 8 =9

principle :
A decimal number 632 It can be expressed as
=600    + 30     + 2
=6*10^2 + 3*10^1 + 2*10^0
Similarly, a binary number 11011 It can be expressed as
 10000+ 1000+  000   + 10    +1
=1*2^4+ 1*2^3+ 0*2^2 + 1*2^1 +1*2^0
=16   + 8    + 0     + 2     +1

Decimal to binary
A=a(2^0)+b(2^1)+c(2^2)+d(2^3)+e(2^4) ( Isn't the following sum the decimal process )
Now assume that the number is not binary , Divide by base 2 have to
At this time, due to a(2^0)/2 This formula can't be divisible , And the other terms can certainly be divisible . therefore a(2^0) It has to be left over , that is a It has to be left over
( because a and a(2^0) Always equal ), So you can start with the remainder a See the first bit
Business gain :
b(2^0)+c(2^1)+d(2^2)+e(2^3), Divide by the base number 2 The rest b, and so on .
When this number can no longer be 2 Division time , The rest a The number of digits is lower than the original number , And then the remainder is high , So write all the remainder in reverse . nothing less than edcba

©2019-2020 Toolsou All rights reserved,
c Language implementation 《 Student management system 》 No hole is the future of mobile phone ? There are still many problems to be solved Junior , A little sense , Just for mutual encouragement How to use Vue Used in Echarts Visual Library The 11th Blue Bridge Cup Java The second provincial competition B Group part Python- be based on OpenCV Contour fill for flooding algorithm hole filling 【C#】 The realization of student achievement information management system List Common interview questions in the collection and simple ideas China Mobile Science Popularization : Why do mobile networks call “ Cellular mobile network ”【Golang Basic series 10 】Go language On conditional sentences if