tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,22 @@
|
|||
Function toRoman(value) As String
|
||||
Dim arabic As Variant
|
||||
Dim roman As Variant
|
||||
|
||||
arabic = Array(1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
|
||||
roman = Array("M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I")
|
||||
|
||||
Dim i As Integer, result As String
|
||||
|
||||
For i = 0 To 12
|
||||
Do While value >= arabic(i)
|
||||
result = result + roman(i)
|
||||
value = value - arabic(i)
|
||||
Loop
|
||||
Next i
|
||||
|
||||
toRoman = result
|
||||
End Function
|
||||
|
||||
Sub Main()
|
||||
MsgBox toRoman(Val(InputBox("Number, please")))
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue