Write a C program that converts a string representing a number in Roman numeral form to decimal form. The symbols used in the Roman numeral system and their equivalents are given below:
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, the following are roman numbers: XII (12), CII(102), XL (40). The rules for converting a roman number to decimal is as follows:
a. Set the value of the decimal number to zero.
b. Scan the string containing the roman character fro left to right. If the character is not one of the symbols in the numeral symbol set, the program must print an error message and terminate. Otherwise, continue with the following steps:
If the next character is a null character(if the current character is the last character) add the value of the current character to the decimal value.
If the value of the current character is greater than or equal to the value of the next character, add the value of the current character to the de
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment