Difference between revisions of "Addition"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Quiz)
(Quiz)
Line 93: Line 93:
 
|type="{}" }
 
|type="{}" }
 
What is it called when the numbers adds together to make a number bigger than 255 so doesn't fit into the 8 bits?
 
What is it called when the numbers adds together to make a number bigger than 255 so doesn't fit into the 8 bits?
 +
{ Overflow }
  
{ Overflow }
 
 
|| This is an overflow.
 
|| This is an overflow.
 
</quiz>
 
</quiz>

Revision as of 12:26, 20 September 2017

Binary Addition

Binary is being able to add two numbers together but are represented in binary form, which consist of 1s and 0s

There are for possibilities when adding binary numbers, these possibilities are:

a total of 0 (0+0) put down 0
a total of 1 (1+0, 0+1 or 0+0+carried 1) put down 1
a total of 2 (1+1) put down 0, carry 1
a total of 3 (1+1+ carried 1) put down 1, carry 1

For example, solve 6+7 using binary addition:

First convert 6 and 7 from denary to binary using your preferred method

6 = 4+2+0 = 110
7 = 4+2+1 = 111

Then add them keeping in mind the 4 possibilities

110 +

111

0+1 = 1 1+1 = 0 carry 1 1+1+ carried 1 = 1 carry 1 1 + 0 = 1

so 110+111 = 1101. Converting this number back to denary gives us an answer of 13.

You could get 3 numbers to add however you wont be given a situation in which there are more than a total of 3.

For example:

101

101

011+

Which would = 1101

Revision

Quiz

1.

What is 00110101 + 01010001 in binary?
→ 1+1 = 2. Put down o, carry 1
→ 0+0+1 = 1. Put down 1, carry 0
→ 1+0 = 1. Put down 1, carry 0
→ 0+0 = 0. Put down 0 carry 0
→ 1+1 = 2. Put down 0, carry 1
→ 1+0+1 = 2. Put down 0, carry 1
→ 0+1+1 = 2. Put down 0, carry 1
→ 0+0+1 = 1. Put down 1, carry 0
→ 10000110

2.

What is 01110001 + 00011111 in denary?
→ 1+1 = 2. Put down 0, carry 1
→ 0+0+1 = 1. Put down 1, carry 0
→ 0+0 = 0. Put down 0, carry 0
→ 0+0 = 0.Put down 0, carry 0
→ 1+1 = 2. Put down 0, carry 1
→ 1+0+1 = 2. Put down 0, carry 1
→ 1+1+1 = 3. Put down 1, carry 1
→ 0+0+1 = 1. Put down 1, carry 0
→ 11000010
→ 128+64+2 = 194

3.

What is 01101110 + 01100101 in 8-bit binary?
→ 0 + 1 = 1. Put down 1, carry 0.
→ 1 + 0 = 1. Put down 1, carry 0.
→ 1 + 1 = 2. Put down 0, carry 1.
→ 0 + 1 + 1 = 2. Put down 0, carry 1.
→ 0 + 0 + 1 = 1. Put down 1, carry 0.
→ 1 + 1 = 2. Put down 0, carry 1.
→ 1 + 1 + 1 = 3. Put down 1, carry 1.
→ 0 + 0 + 1 = 1. Put down 1, carry 0.
→ 11010011

4.

What is it called when the numbers adds together to make a number bigger than 255 so doesn't fit into the 8 bits?
→ This is an overflow.

Your score is 0 / 0