Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2: In this question we will use a simplified version of the Roman Numerals System to represent positive integers. The digits in this system

image text in transcribed

Question 2: In this question we will use a simplified version of the Roman Numerals System to represent positive integers. The digits in this system are I, V, X, L, C, D and M. Each digit corresponds to a decimal value, as showed in the following table: Roman digit Decimal value X LCDM 10 50 100 500 1000 1 5 A number in the simplified Roman numerals system is a sequence of Roman digits, which follow these 2 rules: 1. The digits form a monotonically non-increasing sequence. That is the value of each digit is less than or equal to the value of the digit that came before it. For example, DLXXVI is a monotonically non-increasing sequence of Roman digits, but XIV is not. 2. There is no limit on the number of times that 'M' can appear in the number. 'D', 'l' and 'V' can each appear at most one time in the number. 'C', 'X' and 'l' can each appear at most four times in the number. For example: IIII, XVII and MMMMMMDCCLXXXXVII are legal numbers in our simplified Roman numeral system, but IIIII, XIV, WI and CCXLIII are not. Write a program that reads from the user a (decimal) number, and prints it's representation in the simplified Roman numerals system. Your program should interact with the user exactly as it shows in the following example: Enter decimal number: 147 147 is CXXXXVII

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

ISBN: 1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago