Produce a table of decimal numbers and roman numerals

Assignment Help Computer Engineering
Reference no: EM132210541

Write a program to produce a table of decimal numbers and roman numerals from 1 to 1000. The Romans used a special method of showing numbers based on the following symbols I,V,X,L,C,D and M representing 1,5,10,50,100,500 and 1000 respectively.

There are a few rules for roman numerals

(a) To write a roman numeral each of the nonzero digits should be treated separately. For example, to write 651=500+100+50+1, D=500,C=100,L=50,I=1, we have DCLI.

(b) The symbols I,X,C and M (symbols representing powers of 10) can be repeated at most 3 times in succession. D, L and V (symbols not representing powers of 10) can never be repeated.

(c) I can be subtracted from V and X only. X can be subtracted from L and C only. C can be subtracted from D and M only. In other words, symbol representing 10x can be subtracted from symbol representing 5 * 10x and 10 * 10x . V, L and D can never be subtracted.

In other words, symbols not representing powers of 10 can never be subtracted. Your program should produce a table of decimal numbers and corresponding roman numerals. As a starting point find how a decimal number can be represented using numbers which has a roman equivalent. Given a decimal number n find the values of a, b, c, d, e, f, g which satisfies

n = a * 1000 + b * 500 + c * 100 + d * 50 + e * 10 + f * 5 + g * 1

This will give you a roman numeral representation which will be correct in most cases. For example, 752 = 500 + 2 * 100 + 50 + 2 * 1 can be converted into DCCLII.

Since we have 2*100 C repeats and since we have 2*1, I repeats. After that you can take care of the special cases where a symbol appears 4 or more times or a nonrepeating symbol appears two or more times. Your final program will have several if-else statements.

Sample output for this assignment is as follows

1 I

2 II

3 III

4 IV

5 V

6 VI

7 VII

8 VIII

.

.

1000 M

Reference no: EM132210541

Questions Cloud

Find all projects supplied by at least one supplier : Find all suppliers that supply at least one part supplied by at least one supplier who supplies at least one red part.
Write a little man program that prints out the sums of odd : Write a Little Man program that prints out the sums of the odd values from 1 to 39. The output will consist of 1, 1+3, 1+3+5, 1+3+5+7... No input is required.
How much cash after taxes would sandra receive : How much cash after taxes would Sandra receive from her investment in the first year if BAL is organized as either an LLC or a C corporation
Display the total net gross amounts and their averages : The program output should show each employee's name, gross pay, and net pay, and should also display the total net gross amounts and their averages.
Produce a table of decimal numbers and roman numerals : Write a program to produce a table of decimal numbers and roman numerals from 1 to 1000.
Prompt for and read numbers into an array : The array should be big enough to hold 20 numbers. You keep reading until the user enters a negative number. You should then print the numbers they entered.
Discuss the concept of true and fair in an auditor report : How as a company auditor you would audit transmission of shares? Discuss the concept of 'true and fair' in an auditor's report
Explain in brief the powers and duties of company auditor : Explain clearly the meaning of 'Verifications of Liabilities' as shown in a Balance Sheet. Explain in brief the powers and duties of company auditor
Calculate a statement of comprehensive income : Calculate a Statement of Comprehensive Income with both expenses (classified by function) and revenues disclosed on the face of the statement

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd