CSC 160 - Computer Programming for Non-majors

Dr. R. M. Siegfried

Computer Science Assignment #3 - Binary Arithmetic

Due Thursday, September 16, 2010

One of the reasons that computers use binary numbers is that it is easier for computers to perform basic arithmetic, such as addition and multiplication.

Computers use basic Boolean algebra (a form of logic) to handle addition and repeated addition and bit-shifting to perform multiplication.

Binary addition is really simple:

	0 + 0 = 0
	0 + 1 = 1 + 0 = 1
	1 + 1 = 10, which means that there is a carry.

Example

			        11	<-- These are the carries
			  0101 1001
			  0010 0011
			  =========
			  0111 1100

Multiplying means adding repeatedly and shifting when we add:


			    0011
			    0011
			========
			    0011
			   0011
			  0000
			0000
			========
			00001001

Using this method, add the following values:

a.   1100 0001		b.   0011 1010
     1001 0010		     1101 0101
     =========		     =========


Multiply the following values:

 c.         1010				d.    0010
            0101				      0110
	    ====				      ====

[Back to the Assignments Index]