#K62802. Integer to Roman Numeral Converter
Integer to Roman Numeral Converter
Integer to Roman Numeral Converter
Given an integer num such that \(1 \leq num \leq 3999\), convert it to its corresponding Roman numeral representation. The conversion is performed by repeatedly subtracting the largest possible Roman numeral value until the given number is reduced to zero.
Roman numerals are based on the following symbols:
- I - 1
- V - 5
- X - 10
- L - 50
- C - 100
- D - 500
- M - 1000
Some numbers require subtractive notation, e.g. \(4\) as IV and \(9\) as IX. Implement a function that outputs the correct Roman numeral for the provided number.
inputFormat
The input consists of a single line containing an integer \(num\) where \(1 \leq num \leq 3999\).
outputFormat
Output the corresponding Roman numeral representation as a string.
## sample1
I