为了能快速进行进制装换,需要记住一些数:
2^0,2^1,2^2,2^3,2^4,2^5,2^6,2^7,2^8,2^9,2^10....
1,2,4,8,16,32,64,128,256,512,1024
十进制转二进制:
1.将十进制拆分成上述2的次方的加法
1998 = 1024+974
974 = 512+462
462 = 256+206
206 = 128+78
78 = 64+14
14 = 8+6
6 = 4+2
2 = 2+0
1998 = 1024+512+256+128+64+8+4+2
1024 = 2^10 = 10000000000
512 = 2^9 = 1000000000
256 = 2^8 = 100000000
128 = 2^7 = 10000000
64 = 2^6 = 1000000
8 = 2^3 = 1000
4 = 2^2 = 100
2 = 2^1 = 10
所以:1998 = 11111001110(二进制) 所以很简单
二进制转八进制(三化一)
110 111 100 = 674
八进制转二进制(1化3)
674(八进制) = 110 111 100
16进制就是4化1