Question: Write a function called num roman that converts values between 1 and 3 9 9 9 into Roman numerals. The input will be a scalar

Write a function called "num roman" that converts values between 1 and 3999 into Roman numerals. The input will be a scalar number and the output is a string of Roman numerals thatrepresent the input number. The function should give separate meaningful error messages if the input is less than one, if the input is greater than 3999, or if the input is an array. If no input is given the default value is 2024. The function should round a fractional value to the closest integer.For legitimate values, the function should build up a string as follows where x is the input: while (x>=1000) subtract 1000 from x and concatenate 'M' to the string if(x>=900) subtract 900 from x and concatenate 'CM' to the string if(x>=500) subtract 500 from x and concatenate 'D' to-the string if(x>=400) subtract 400 from x and concatenate 'CD' to the string while (x>=100) subtract 100 from x and concatenate 'C' to the string if(x>=90) subtract 90 from x and concatenate 'XC' to the string lif(x>=50) subtract 50 from x and concatenate L' to the string if(x>=40) subtract 40 from x and concatenate 'XL' to the string while (x>=10) subtract 10 from x and concatenate "X' to the string if(x>=9) subtract 9 from x and concatenate 'IX' to the string if(x>-5) subtract 5 from x and concatenate "V' to the string if(x>=4) subtract 4 from x and concatenate 'IV' to the string while (x>=1) subtract 1 from x and concatenate 'I' to the stringConcatenate means to add text to the end of a current string (no spaces!)
Write a function called "num roman" that converts

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!