Cody

# Problem 63. Encode Roman Numerals

Solution 1853948

Submitted on 20 Jun 2019 by Albit
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))

a = 'M' n = 990 a = 'MCM' n = 90 a = 'MCMXC' n = 0

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

a = 'M' n = 1008 a = 'MM' n = 8 a = 'MMV' n = 3 a = 'MMVI' n = 2 a = 'MMVII' n = 1 a = 'MMVIII' n = 0

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

a = 'M' n = 666 a = 'MD' n = 166 a = 'MDC' n = 66 a = 'MDCL' n = 16 a = 'MDCLX' n = 6 a = 'MDCLXV' n = 1 a = 'MDCLXVI' n = 0

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

a = 'XL' n = 9 a = 'XLIX' n = 0

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

a = 'XL' n = 5 a = 'XLV' n = 0

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