Cody

Solution 1924809

Submitted on 7 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 = 1990; y_correct = 'MCMXC'; assert(isequal(dec2rom(x),y_correct))

t = 0 9 9 1 l1 = 'M' l2 = 0×0 empty char array l3 = 'XC' l4 = 'CM' romStr = 'MCMXC'

2   Pass
x = 2008; y_correct = 'MMVIII'; assert(isequal(dec2rom(x),y_correct))

t = 8 0 0 2 l1 = 'MM' l2 = 'VIII' l3 = 0×0 empty char array l4 = 0×0 empty char array romStr = 'MMVIII'

3   Pass
x = 1666; y_correct = 'MDCLXVI'; assert(isequal(dec2rom(x),y_correct))

t = 6 6 6 1 l1 = 'M' l2 = 'VI' l3 = 'LX' l4 = 'DC' romStr = 'MDCLXVI'

4   Pass
x = 49; y_correct = 'XLIX'; assert(isequal(dec2rom(x),y_correct))

t = 9 4 t = 9 4 0 0 l1 = 0×0 empty char array l2 = 'IX' l3 = 'XL' l4 = 0×0 empty char array romStr = 'XLIX'

5   Pass
x = 45; y_correct = 'XLV'; assert(isequal(dec2rom(x),y_correct))

t = 5 4 t = 5 4 0 0 l1 = 0×0 empty char array l2 = 'V' l3 = 'XL' l4 = 0×0 empty char array romStr = 'XLV'

6   Fail
x = 0; y_correct = ''; assert(isempty(dec2rom(x)))

t = 0

Index exceeds the number of array elements (1). Error in dec2rom (line 11) if t(4)==1 Error in Test6 (line 3) assert(isempty(dec2rom(x)))