Cody

# Problem 2678. Find out sum and carry of Binary adder

Solution 1934233

Submitted on 13 Sep 2019 by Renato SL
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = 1; y=1; pc=1; [sum, carry]=bin_sum_carry(pc,x,y) assert(isequal(sum,1)) assert(isequal(carry,1))

sum = logical 1 carry = logical 1 sum = logical 1 carry = logical 1

2   Pass
x = 1; y=1; pc=0; [sum, carry]=bin_sum_carry(pc,x,y) assert(isequal(sum,0)) assert(isequal(carry,1))

sum = logical 0 carry = logical 1 sum = logical 0 carry = logical 1

3   Pass
x = 1; y=0; pc=0; [sum, carry]=bin_sum_carry(pc,x,y) assert(isequal(sum,1)) assert(isequal(carry,0))

sum = logical 1 carry = logical 0 sum = logical 1 carry = logical 0

4   Pass
x = 0; y=0; pc=0; [sum, carry]=bin_sum_carry(pc,x,y) assert(isequal(sum,0)) assert(isequal(carry,0))

sum = logical 0 carry = logical 0 sum = logical 0 carry = logical 0

5   Pass
x = 1; y=1; pc=0; [sum, carry]=bin_sum_carry(pc,x,y) assert(isequal(sum,0)) assert(isequal(carry,1))

sum = logical 0 carry = logical 1 sum = logical 0 carry = logical 1