binary Arithmatic using c# windows application

Discussion in 'Programmer's Corner' started by Abel Assegid, Dec 22, 2007.

  1. Abel Assegid

    Thread Starter Member

    Nov 5, 2007
    13
    0
    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:
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    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:

    Code ( (Unknown Language)):
    1.  
    2.  A  B  Ci  |  S  Co
    3. -------------------
    4.  0  0  0   |  0  0
    5.  0  0  1   |  1  0
    6.  0  1  0   |  1  0
    7.  0  1  1   |  0  1
    8.  1  0  0   |  1  0
    9.  1  0  1   |  0  1
    10.  1  1  0   |  0  1
    11.  1  1  1   |  1  1
    12.  
    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.
     
Loading...