Cody

Solution 2072805

Submitted on 28 Dec 2019 by Asif Newaz
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))

d = 1 c = 990 y = 'M' d = 1 c = 90 y = 'MCM' d = 1 c = 0 y = 'MCMXC'

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

d = 2 c = 8 y = 'MM' d = 1 c = 3 y = 'MMV' d = 3 c = 0 y = 'MMVIII'

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

d = 1 c = 666 y = 'M' d = 1 c = 166 y = 'MD' d = 1 c = 66 y = 'MDC' d = 1 c = 16 y = 'MDCL' d = 1 c = 6 y = 'MDCLX' d = 1 c = 1 y = 'MDCLXV' d = 1 c = 0 y = 'MDCLXVI'

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

d = 1 c = 9 y = 'XL' d = 1 c = 0 y = 'XLIX'

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

d = 1 c = 5 y = 'XL' d = 1 c = 0 y = 'XLV'

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