+ 4
hey guys can you help me to understand why 00000100 is 64 ?
15 Antworten
+ 5
guys the position of 1 is the 3rd
+ 5
at 3rd position is 4bit
+ 5
always raise in 3
+ 4
001000000 = 2^6 =64
counting from the right, the first spot has value 2^0, the second 2^1 and so on. The 1 is in place with value 2^6.
+ 4
so it actually is equal to 4 but we assumed it was read backwards
+ 4
ill try this in c
ex: int x = 00000100;
printf("%d",x);
result: 64
why??
+ 4
but if we read backward the result is 32 because the 64 is the second position start from last
+ 4
128,64,32,16,8,4,2,1 normal
1,2,4,8,16,32,64,128 backwards
my position of my 1's is the 3rd position 😯 in normal and 6th position backwards
+ 4
oh guys i know now
the formula
my 1's is the position of 3rd and the value is 4 now we need it to raise in 3 to get the value
4*4*4 = 64
and if we try in 01000000
you get the value if you raise the bit in 3 😃
+ 3
Numbers in C are read in different bases based on the prefix:
No prefix -> decimal (base 10)
'0' prefix -> octal (base 8)
'0x' prefix -> hexadecimal (base 16)
'0b' prefix -> binary (base 2)
When you write 00000100 the compiler sees that it starts with '0' and assumes it to be base 8.
https://code.sololearn.com/cU3TDoNmza71/?ref=app
+ 3
isn't it in octodecimal, 10 = 8, 100 = 8*8 = 64
+ 2
64 in binary is:
(64)(32)(16)(8)(4)(2)(1)
1. 0. 0. 0. 0 0. 0
what is 12 in binary?
0001100
+ 2
00000100 is 4, not 64
+ 2
Gutch From Ph Yep and you raise in 3 because it's base 8 (2^3). 010000000 would be 128*128*128, or 8^7.
+ 1
correct, just read it left to right.