Integer to Roman

Problem Convert an integer (1 to 3999) to its Roman numeral, handling subtractive notation (IV, IX, XL, XC, CD, CM).

Input / Output

  • Input: an integer num (1 ≤ num ≤ 3999).
  • Output: the Roman numeral string.

Constraints

  • 1 ≤ num ≤ 3999 (classic range).

Example

  • 1994 → "MCMXCIV" (M + CM + XC + IV).
  • 58 → "LVIII".
asked …
LeaderboardSalaryAccount