 # Roman Numeric Conversion

I dont want to ask anything code related, but I just want to ask about the logic behind the conversion.

I looked it up online and they said there is a rule of subtraction.

``````1 2 3 4 5
translate to roman numeric is:
I II III IV V
``````

and noticed that 4 is `IV` which is literally V minus I.
So we put the bigger number at second and the smaller number up front.
Then we do subtraction.

So I have a question then… when do we need to apply this rule of subtraction then??
Let’s say, I have a number 98, I can see it as : 100-10+8 or I can see it as 40+50+8.
So when do I know I need to use the 1st method and vise versa, when do I know to use the second method?
(and the second method is wrong btw…)

to put this question in another way:

to convert number 98, we need to use subtraction:
98 =90+8=-10+100+5+1+1+1
=> XCVIII

but when it comes to 88 we need to use addition:
88=50+10+10+10+5+1+1+1
=> LXXXVIII

when do we know we need to use method one or method 2???

2 Likes

so as long as the number contains 4 or 9, we need to use subtraction instead of addition.

thanks!