1. Engineering
2. Computer Science
3. programming challenge to convert cardinal number to roman numerical many...

# Question: programming challenge to convert cardinal number to roman numerical many...

###### Question details

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('\n');

for(var i=0; i<lines.length; i++) {

process.stdout.write(lines[i]);

}

});

please all your work with screen for the output.

###### Solution by an expert tutor 