The OR operation works on bits. If either bit of two in an OR operation is 1, then the result is 1, so:
4 = 100 3 = 011 -------- 111
so the result must be 7 (or 4 + 2 + 1).
Make visible what, without you, might perhaps never have been seen. - Robert Bresson
Karu Raj
Ranch Hand
Joined: Aug 31, 2005
Posts: 479
posted
0
how did you convert the 4 to bits representation?
anand phulwani
Ranch Hand
Joined: Sep 10, 2005
Posts: 242
posted
0
To Convert any decimal number into binary we can folow these steps
Lets Do it With An Exammple decimal 22 into binary
make a table like this 1 2 4 8 16 32 64 .. .. ..
if u wanna convert 22 look for the number or the number just smaller than this,so what i see that the table does not have 22 so the number next smaller than this is 16,write 1 in front of it
1 2 4 8 16--1 32 64 .. .. ..
ok next step reduce 16 from the number 22,22-16=6 now we get the number 6 repeat the same procedure,we do not have 6 in the table but do have 4, write 1 in front of it
1 2 4 --1 8 16--1 32 64 .. .. .. now the repeat the same deduct 4 out of 6 ,6-4=2 you got 2 which is in the table,write 1 in front of it
1 2 --1 4 --1 8 16--1 32 64 .. .. ..
now when u deduct you 0,2-2=0 so ur binary is complete now to the remaining table numbers put a 0 in front of it
1 --0 2 --1 4 --1 8 --0 16--1 32 64 .. .. .. now just read the number from down to up,10110 here is your binary conversion hope you understand this easily
Thanks and Regards, Anand
SCJP 5.0 310-055 73%, SCWCD 1.4 310-081 78%, IBM DB2 9 Fundamentals 000-730 62%
Mr. Michael I wanna Know How 2s Complement Representation Works thanks With Regards
Agrah Upadhyay 3rd Year B.Tech
<i>--Agrah Upadhyay--</i><br />Final Year B.Tech SCJP,SCWCD,SCBCD <br /> <br /><b>Now since the real test for any choice is having to make the same choice again,knowing full well what it might cost.</b>-Oracle
Karu Raj
Ranch Hand
Joined: Aug 31, 2005
Posts: 479
posted
0
Thanks a lot very much
i am gratefull to all of you
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.