6 kyu

Roman Numerals Encoder

15,996 of 56,523jhoffner

Description:

Create a function taking a positive integer between 1 and 3999 (both included) as its parameter and returning a string containing the Roman Numeral representation of that integer.

Modern Roman numerals are written by expressing each digit separately starting with the leftmost digit and skipping any digit with a value of zero. There cannot be more than 3 identical symbols in a row.

In Roman numerals:

  • 1990 is rendered: 1000=M + 900=CM + 90=XC; resulting in MCMXC.
  • 2008 is written as 2000=MM, 8=VIII; or MMVIII.
  • 1666 uses each Roman symbol in descending order: MDCLXVI.

Example:

   1 -->       "I"
1000 -->       "M"
1666 --> "MDCLXVI"

Help:

Symbol    Value
I          1
V          5
X          10
L          50
C          100
D          500
M          1,000

More about roman numerals

Algorithms

Stats:

CreatedJun 10, 2013
PublishedJun 10, 2013
Warriors Trained167219
Total Skips30427
Total Code Submissions215856
Total Times Completed56523
JavaScript Completions15996
CoffeeScript Completions134
Ruby Completions1939
Python Completions15352
Haskell Completions603
Java Completions7100
TypeScript Completions1754
C++ Completions3878
PHP Completions1911
C# Completions3744
Swift Completions858
Elixir Completions226
Rust Completions972
R Completions174
Solidity Completions208
C Completions1307
Nim Completions32
Lua Completions173
Scala Completions243
Kotlin Completions703
Julia Completions40
Clojure Completions34
COBOL Completions9
Go Completions595
F# Completions24
Total Stars3344
% of votes with a positive feedback rating90% of 5418
Total "Very Satisfied" Votes4504
Total "Somewhat Satisfied" Votes793
Total "Not Satisfied" Votes121
Ad
Contributors
  • jhoffner Avatar
  • dnolan Avatar
  • seidchr Avatar
  • cvk77 Avatar
  • Unnamed Avatar
  • bstenzel Avatar
  • JDeBolt Avatar
  • brunolm Avatar
  • ver0man Avatar
  • donaldsebleung Avatar
  • Quickz Avatar
  • Chrono79 Avatar
  • imjasonmiller Avatar
  • dorialan Avatar
  • user4912975 Avatar
  • Ze-Marcos Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • mentalplex Avatar
  • rsa Avatar
  • Udiknedormin Avatar
  • metagn Avatar
  • FArekkusu Avatar
  • konkath Avatar
  • hobovsky Avatar
  • xavierguihot Avatar
  • stellartux Avatar
  • trashy_incel Avatar
  • ejini战神 Avatar
  • slnt_opp Avatar
  • BrainHorse Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • 4500zenja1 Avatar
  • KayleighWasTaken Avatar
Ad