Cody

Problem 2609. If-then-else

Solution 1917787

Submitted on 1 Sep 2019
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 = 10; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18

2   Pass
x = 14; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18

3   Pass
x = 11; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18

4   Pass
x = 12; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18

5   Pass
x = 13; y_correct = 18; assert(isequal(if_then_else(x),y_correct))

y = 18

6   Fail
x = 9; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 18

Assertion failed.

7   Fail
x = 15; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 18

Assertion failed.

8   Fail
x = 0; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 18

Assertion failed.

9   Fail
x = 100; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 18

Assertion failed.

10   Fail
x = -2; y_correct = 7; assert(isequal(if_then_else(x),y_correct))

y = 18

Assertion failed.