Using logic gates you can make a circuit called an [adder](https://en.wikipedia.org/wiki/Adder_(electronics)). An adder takes in inputs like other gates but it’s function is to produce outputs that effectively adds the inputs together, in a binary fashion. Here is the truth table for a half adder
Input 1| Input 2 | Carry | Sum | Explanation
:-:|:-:|:-:|:-:|:-:
0 | 0 | 0 | 0 | 0 + 0 = 0 and nothing to carry over.
1 | 0 | 0 | 1 | 1 + 0 = 1 and nothing to carry over.
0 | 1 | 0 | 1 | 0 + 1 = 1 and nothing to carry over.
1 | 1 | 1 | 0 | 1 + 1 = 0 and carry the 1 because we are adding in base 2.
If you allow for an adder to accept a carry as well as inputs 1 and 2, you have something called a full adder. The truth table for a full adder is a bit longer but you can check that wikipedia link to see it. If you chain a bunch of these adders together you can add big numbers. If you combine these circuit in other ways you can make other functions like subtraction, multiplication, and division.
Latest Answers