binary Arithmatic using c# windows application

Thread Starter

Abel Assegid

Joined Nov 5, 2007
13
I was given an assignment to write a C# program that takes binary no.s and
performs binary arithmaic operations on it. I need a code for the adder . I tried one of mine but it failed. Could anyone please help me out of this!!!!!!:confused:
 

Papabravo

Joined Feb 24, 2006
21,225
Your not serious! Well maybe you are. Think two functions of three boolean variables. Call the functions "Sum" and "Carry". Now write some truth tables:

Rich (BB code):
 A  B  Ci  |  S  Co
-------------------
 0  0  0   |  0  0
 0  0  1   |  1  0
 0  1  0   |  1  0
 0  1  1   |  0  1
 1  0  0   |  1  0
 1  0  1   |  0  1
 1  1  0   |  0  1
 1  1  1   |  1  1
For the stage corresponding to the least significant bit set Ci (Carry In = 0). For each successive stage set Ci (Carry In) equal to Co (Carry Out) from the previous stage. Notice that the "Sum" function is actuall the exclusive or of the three variables.
 
Top