Question
Coding language : NODE JS (JavaScript) Programming challenge to convert cardinal number to roman numerical Many people are familiar with the roman numerals for relatively
Coding language : NODE JS (JavaScript)
Programming challenge to convert cardinal number to roman numerical
Many people are familiar with the roman numerals for relatively small numbers, The symbols I (capital i), V, X, L, C, D, and M represent the decimal value 1, 5, 10, 50, 100, 500 and 1000 respectively. To represent other values, these symbols and multiple where necessary, are concatenated, with the smaller- valued symbols written further to the right. For examples, the number 3 is represented as III and the value 73 kis represented as LXXIII. The exceptions to this rules occur for numbers having untils values of 4 or 9, and for tens values of 40 or 90 for these case, the roman numeral representation are IV (4) IX (9), XL(40), and XC(90). So the Roman numeral representations for 24, 39, 44, 49, and 94 are XXIV, XXXIX, XLIV, XLIX and XCIV, respectively.
Write a program to convert a cardinal number to a Roman numeral,
Input
Your program should read lines from the standard input. Each line contains a cardinal number N(1 <= N <= 3999)
Output
Print out the value of N in Roman numeral
Code given:
process.stdin.resume();
process.stdin.setEncoding('utf8');
var stdin = ' ';
process.stdin.on('data', function (chunk) {
stdin += chunk;
}).on('end', function() {
var lines = stdin.trim().split(' ');
for(var i=0; i process.stdout.write(lines[i]); } }); please all your work with screen for the output.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started