Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6c9aec3

Browse files
Create romannumeralconverter.md
1 parent d9d40c5 commit 6c9aec3

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
☕ 🔥
2+
3+
Convert the given number into a roman numeral.
4+
5+
| Roman numerals | Arabic numerals |
6+
| ------------------- | ------------------- |
7+
|M | 1000 |
8+
|CM | 900 |
9+
|D | 500 |
10+
|CD | 400 |
11+
|C | 100 |
12+
|XC | 90 |
13+
|L | 50 |
14+
|XL | 40 |
15+
|X | 10 |
16+
|IX | 9 |
17+
|V | 5 |
18+
|IV | 4 |
19+
|I | 1 |
20+
21+
All roman numerals answers should be provided in upper-case.
22+
23+
<h1>Tests :</h1>
24+
25+
convertToRoman(2) should return the string II.
26+
27+
convertToRoman(3) should return the string III.
28+
29+
convertToRoman(4) should return the string IV.
30+
31+
convertToRoman(5) should return the string V.
32+
33+
convertToRoman(9) should return the string IX.
34+
35+
convertToRoman(12) should return the string XII.
36+
37+
convertToRoman(16) should return the string XVI.
38+
39+
convertToRoman(29) should return the string XXIX.
40+
41+
convertToRoman(44) should return the string XLIV.
42+
43+
convertToRoman(45) should return the string XLV.
44+
45+
convertToRoman(68) should return the string LXVIII.
46+
47+
convertToRoman(83) should return the string LXXXIII.
48+
49+
convertToRoman(97) should return the string XCVII.
50+
51+
convertToRoman(99) should return the string XCIX.
52+
53+
convertToRoman(400) should return the string CD.
54+
55+
convertToRoman(500) should return the string D.
56+
57+
convertToRoman(501) should return the string DI.
58+
59+
convertToRoman(649) should return the string DCXLIX.
60+
61+
convertToRoman(798) should return the string DCCXCVIII.
62+
63+
convertToRoman(891) should return the string DCCCXCI.
64+
65+
convertToRoman(1000) should return the string M.
66+
67+
convertToRoman(1004) should return the string MIV.
68+
69+
convertToRoman(1006) should return the string MVI.
70+
71+
convertToRoman(1023) should return the string MXXIII.
72+
73+
convertToRoman(2014) should return the string MMXIV.
74+
75+
convertToRoman(3999) should return the string MMMCMXCIX.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /