Given a Roman numeral, convert to Decimal format; given a Decimal number, convert to Roman numeral.
I = 1
V = 5
X = 10
L = 50
C = 100
D = 500
M = 1000
III = 1 + 1 + 1 = 3
VII = 5 + 1 + 1 = 7
IV = 5 – 1 = 4
LL = 50 + 50 = 100 = ERROR!
XX = 10 + 10 = 20
LC = 100 – 50 = 50 = ERROR!
MCMLVII = 1000 + ( 1000 – 100 ) + 50 + ( 5 + 1 + 1 ) = 1957
CC = 100 + 100 = 200
XC = 100 – 10 = 90
IC = 100 – 1 = 99 = ERROR
$Number = new RomanNumeral(‘XVII’);
$Number→toInt();