Lesson 10 of 15

Full Adder

Full Adder

A full adder adds three bits: two inputs A, B, and a carry-in (Cin). It produces a sum and a carry-out (Cout).

ABCinSumCout
00000
00110
01010
01101
10010
10101
11001
11111

The full adder is built from two half adders:

step1 = halfAdder(A, B)        → {sum: s1, carry: c1}
step2 = halfAdder(s1, Cin)     → {sum: S, carry: c2}
Cout  = c1 OR c2

Your Task

Implement fullAdder(a, b, cin) that returns { sum, carry }. Use your half adder internally.

JavaScript loading...
Loading...
Click "Run" to execute your code.