Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Roman-numerals-Encode/BaCon/roman-numerals-encode.bacon
Normal file
23
Task/Roman-numerals-Encode/BaCon/roman-numerals-encode.bacon
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
OPTION BASE 1
|
||||
|
||||
GLOBAL roman$[] = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" }
|
||||
GLOBAL number[] = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }
|
||||
|
||||
FUNCTION toroman$(value)
|
||||
|
||||
LOCAL result$
|
||||
|
||||
DOTIMES UBOUND(number)
|
||||
WHILE value >= number[_]
|
||||
result$ = result$ & roman$[_]
|
||||
DECR value, number[_]
|
||||
WEND
|
||||
DONE
|
||||
|
||||
RETURN result$
|
||||
|
||||
ENDFUNC
|
||||
|
||||
PRINT toroman$(1990)
|
||||
PRINT toroman$(2008)
|
||||
PRINT toroman$(1666)
|
||||
Loading…
Add table
Add a link
Reference in a new issue