Cody

# Problem 63. Encode Roman Numerals

Solution 1435227

Submitted on 6 Feb 2018 by Chuck Saunders
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))

check n = 0 n = 0 check n = 9 n = 9 firstBit = 'XC' check n = 9 n = 9 firstBit = 'CM' check n = 1 n = 1 firstBit = 'M'

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

check n = 8 n = 8 firstBit = 'VIII' check n = 0 n = 0 check n = 0 n = 0 check n = 2 n = 2 firstBit = 'MM'

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

check n = 6 n = 6 firstBit = 'VI' check n = 6 n = 6 firstBit = 'LX' check n = 6 n = 6 firstBit = 'DC' check n = 1 n = 1 firstBit = 'M'

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

check n = 9 n = 9 firstBit = 'IX' check n = 4 n = 4 firstBit = 'XL'

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

check n = 5 n = 5 firstBit = 'V' check n = 4 n = 4 firstBit = 'XL'

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

check n = 0 n = 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!