answersLogoWhite

0

Function dec2rom(dec As Integer) As String

dec2rom = ""

While dec >= 1000

dec2rom += "M"

dec -= 1000

End While

If dec >= 900 Then

dec2rom += "CM"

dec -= 900

End If

If dec >= 500 Then

dec2rom += "D"

dec -= 500

End If

If dec >= 400 Then

dec2rom += "CD"

dec -= 400

End If

While dec >= 100

dec2rom += "C"

dec -= 100

End While

If dec >= 90 Then

dec2rom += "XC"

dec -= 90

End If

If dec >= 50 Then

dec2rom += "L"

dec -= 50

End If

If dec >= 40 Then

dec2rom += "XL"

dec -= 40

End If

While dec >= 10

dec2rom += "X"

dec -= 10

End While

If dec >= 9 Then

dec2rom += "IX"

dec -= 9

End If

If dec >= 5 Then

dec2rom += "V"

dec -= 5

End If

If dec >= 4 Then

dec2rom += "IV"

dec -= 4

End If

While dec

dec2rom += "I"

dec -= 1

End While

End Function

User Avatar

Wiki User

10y ago

What else can I help you with?