Cody

Solution 2174591

Submitted on 25 Mar 2020 by Ahmed Abdelbasit
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 = 2015; y_correct=[1,1,1,1,1,0,1,1,1,1,1]; assert(isequal(dectobin(x),y_correct))

y = [] y = 1 x = 1007 y = 1 1 x = 503 y = 1 1 1 x = 251 y = 1 1 1 1 x = 125 y = 1 1 1 1 1 x = 62 y = 0 1 1 1 1 1 x = 31 y = 1 0 1 1 1 1 1 x = 15 y = 1 1 0 1 1 1 1 1 x = 7 y = 1 1 1 0 1 1 1 1 1 x = 3 y = 1 1 1 1 0 1 1 1 1 1 x = 1 y = 1 1 1 1 1 0 1 1 1 1 1 x = 0

2   Pass
x = 13; y_correct=[1,1,0,1]; assert(isequal(dectobin(x),y_correct))

y = [] y = 1 x = 6 y = 0 1 x = 3 y = 1 0 1 x = 1 y = 1 1 0 1 x = 0

3   Pass
x = 143; y_correct=[1,0,0,0,1,1,1,1]; assert(isequal(dectobin(x),y_correct))

y = [] y = 1 x = 71 y = 1 1 x = 35 y = 1 1 1 x = 17 y = 1 1 1 1 x = 8 y = 0 1 1 1 1 x = 4 y = 0 0 1 1 1 1 x = 2 y = 0 0 0 1 1 1 1 x = 1 y = 1 0 0 0 1 1 1 1 x = 0