Cody

# Problem 2522. Convert given decimal number to binary number.

Solution 2685518

Submitted on 13 Jul 2020 at 3:24
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   Fail
x = 10; y_correct = 1010; assert(isequal(dec_bin(x),y_correct))

b = 1 b = 2 b = 3 b = 4 c = 3 z = 10 sum = 1000 z = 2 c = 2 c = 1 sum = 1010 z = 0 c = 0 c = -1

Unrecognized function or variable 'arr'. Error in dec_bin (line 17) y = arr ; Error in Test1 (line 3) assert(isequal(dec_bin(x),y_correct))

2   Fail
x = 2; y_correct = 10; assert(isequal(dec_bin(x),y_correct))

b = 1 c = 0 z = 2 sum = 1 z = 1 c = -1

Unrecognized function or variable 'arr'. Error in dec_bin (line 17) y = arr ; Error in Test2 (line 3) assert(isequal(dec_bin(x),y_correct))

3   Fail
x = 15; y_correct = 1111; assert(isequal(dec_bin(x),y_correct))

b = 1 b = 2 b = 3 b = 4 c = 3 z = 15 sum = 1000 z = 7 c = 2 sum = 1100 z = 3 c = 1 sum = 1110 z = 1 c = 0 sum = 1111 z = 0 c = -1

Unrecognized function or variable 'arr'. Error in dec_bin (line 17) y = arr ; Error in Test3 (line 3) assert(isequal(dec_bin(x),y_correct))