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))
z =
1 1
sum =
1
carry =
1
sum =
1
carry =
1

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

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

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

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

1087 Solvers
How to find the position of an element in a vector without using the find function
2435 Solvers
Determine if a Given Number is a Triangle Number
311 Solvers
Project Euler: Problem 3, Largest prime factor
302 Solvers
Matrix indexing with two vectors of indices
461 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!