Cody

Problem 302. Convert Roman to Arabic Numerals

Solution 1946005

Submitted on 22 Sep 2019 by Augusto Mazzei
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 = 'XIX'; y_correct = 19; assert(isequal(roman(x),y_correct))

arab = 19

2   Pass
x = 'IV MMXII LIV'; y_correct = [4 2012 54]; assert(isequal(roman(x),y_correct))

arab = 4 arab = 4 2012 arab = 4 2012 54

3   Pass
x = 'MDCCCCX MCMIII MCMX'; y_correct = [1910 1903 1910]; assert(isequal(roman(x),y_correct))

arab = 1910 arab = 1910 1903 arab = 1910 1903 1910

4   Pass
x = 'MDCCCCLXXXXVIIII MCMXCIX MIM'; y_correct = [1999 1999 1999]; assert(isequal(roman(x),y_correct))

arab = 1999 arab = 1999 1999 arab = 1999 1999 1999

Suggested Problems

More from this Author39

Community Treasure Hunt

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

Start Hunting!