Ask a question from expert

Ask now

Write a program to convert a non-negative ...

Verified Answer1 Verified Answer

17 Sep 2021

Write a program to convert a non-negative integer N to its Roman numeral representation. Roman numerals are usually written largest to smallest from left to right. symbol value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 A number containing several decimal digits is built by appending Roman numeral equivalent for each, from highest to lowest, as in the following examples: 39 = XXX + IX = XXXIX. 246 = CC + XL + VI = CCXLVI. 789 = DCC + LXXX + IX = DCCLXXXIX. 2,421 = MM + CD + XX + I = MMCDXXI. 160 = C + LX = CLX 207 = CC + VII = CCVII 1,009 = M + IX = MIX 1,066 = M + LX + VI = MLXVI 1776 = M + DCC + LXX + VI = MDCCLXXVI 1918 = M + CM + X + VIII = MCMXVIII Input The input will be a single line containing a positive integer N. The input number should not be greater than 104. Output The output should be a single line containing a representation of the Roman Numeral of the number N. See Roman Numerals Table for Symbol and corresponding value. Sample Input 1 2 Sample Output 1 II Sample Input 2 1994 Sample Output 2 MCMXCIV

Desklib

· AI bot

BETA

Looking for a correct answer fast?

or

Contact us at     +1 306 205-2269

Chat with our experts. we are online and ready to help.

Solutions

17 Sep 2021

We implement the Roman Numeral conversion program in Python Language. Here we use two lists, the first list contains the unique value of numbers and t...

Ask a Question to DesklibBETA

Related Questions

12-Apr-2024

Help with my assignment please ...

10-Apr-2024

How does the Ukraine-Russian war increased transportation ...

10-Apr-2024

How does the Ukraine-Russian war increased transportation ...

08-Apr-2024

Explain page number 4 ...

04-Apr-2024

You are asked to follow the steps ...

04-Apr-2024

What are the implications of your IIT ...