Op 18-9-2020 om 16:13 schreef Pablo
Navarro:
Hi! Maybe you can use this algorithm:
Define a dictionary with these elements:
1000:'M',
900:'CM',
500: 'D',
400: 'CD',
100:"C",
90:'XC',
50:'L',
40:'XL',
10:'X',
9:'IX',
5:'V',
4:'IV',
1:'I'
Using this dictionary (romansDic), you define a recursive function:
toRomans(number){
i = return the greatest key less than or equal to given key from ‘romansDic' .
if (number == i ){
return romansDic.get(number)
}
return string_concat(romansDic.get(i), toRomans(number-i))
}
Sorry for the pseudocode.
Saludos Pablo.
No problem. I searching for a idea not somebody who solves it for me.
Roelof