Challenge: Roman numerals! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 8

Challenge: Roman numerals!

Need to write a function that takes arabic numerals and return the roman numerals. Roman numerals: I = 1 V = 5 X = 10 L = 50 C = 100 D = 500 M = 1000 Example: 10 -> X 6 -> VI 76 -> LXXVI 499 -> CDXCIX ... Precondition: Input: integer (0 < input < 3999) Output: string Please set the language in comment!!! If you resolve this task set plus!!!

16th Dec 2017, 1:19 PM
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ¾Š·Š»Š¾Š²ŃŠŗŠøŠ¹
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ¾Š·Š»Š¾Š²ŃŠŗŠøŠ¹ - avatar
13 Respostas
17th Dec 2017, 3:58 PM
qwerty
qwerty - avatar
16th Dec 2017, 7:12 PM
LukArToDo
LukArToDo - avatar
+ 7
https://code.sololearn.com/cLOi9wpPOJjF/?ref=app Works between 1-4000000(excluded)
16th Dec 2017, 2:15 PM
Kartikey Sahu
Kartikey Sahu - avatar
29th Mar 2018, 5:22 AM
KƤzĆ® MrĆ®dĆ¹l HĆøssƤƮn
KƤzĆ® MrĆ®dĆ¹l HĆøssƤƮn - avatar
+ 5
https://code.sololearn.com/cSl9R9bLoLcd/?ref=app
16th Dec 2017, 6:29 PM
GAWEN STEASY
GAWEN STEASY - avatar
29th Mar 2018, 1:49 PM
Hamid
Hamid - avatar
+ 2
My first code ever, in Python 3: https://code.sololearn.com/cF88oyMa3W15/#py If you have any comments, let me know!
16th Apr 2018, 12:10 PM
Tom Stokkel
Tom Stokkel - avatar
17th Dec 2017, 10:03 PM
Rabee Abbas
Rabee Abbas - avatar
+ 1
My try in PHP : https://code.sololearn.com/wxN8Wu6W58Cm/#php I hope you'll understand my technical comment in english ;) I notice that Roman numerals work by pairs "unit" and "five" for every decimal in base10 (I and V, X and L, ...). I use base5 conversion for every base10 position. + a test when last number (unit) is 4 in base5 : in that case I use 1 unit before the next letter depending on the next col in base5 (0 or 1) thus "five" or next unit. The second function is only for formating purpose while testing.
8th Apr 2018, 7:54 AM
MC59550
MC59550 - avatar
+ 1
My try on python. 1. a integer to roman numeral, work between 0 to 3999. https://code.sololearn.com/caBR7zasyKVz/#py 2. roman numeral convert to integer. https://code.sololearn.com/c9fmB9cIaS3Q/#py
27th Apr 2018, 5:07 PM
spring
spring - avatar
0
Very quickly?! You did that before?
16th Dec 2017, 1:28 PM
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ¾Š·Š»Š¾Š²ŃŠŗŠøŠ¹
Š”ŠµŃ€Š³ŠµŠ¹ ŠšŠ¾Š·Š»Š¾Š²ŃŠŗŠøŠ¹ - avatar
0
tagged
17th Dec 2017, 8:39 PM
Rabee Abbas
Rabee Abbas - avatar