amrit singh

Ranch Hand

Posts: 42

anil bisht

Ranch Hand

Posts: 81

posted 16 years ago

10101010

+

10101010

we will try this

10

+

10

0+0 = 0

1+1 = 2 but its binary so u have to write 1+1 = 10( binary)

so 0 is to be placed there and 1 is the carry

now add 0 + 0 + 1 = 1

so the answer is

100

so ur answer is 101010100

but if u have the size of 8 bits the last bit will be lost

and u will get 1010100

HTH

anil

+

10101010

we will try this

10

+

10

0+0 = 0

1+1 = 2 but its binary so u have to write 1+1 = 10( binary)

so 0 is to be placed there and 1 is the carry

now add 0 + 0 + 1 = 1

so the answer is

100

so ur answer is 101010100

but if u have the size of 8 bits the last bit will be lost

and u will get 1010100

HTH

anil

It is sorta covered in the JavaRanch Style Guide. |