Roman Numeral Converter

problem

strategy

we should create two kind of arrays.the first one has value of decimal numbers and the second roman numerals.we should also define 900, 400, 90,40, 9, 4 with them cause it will save us a plenty of code.we should use for loop to access each number in numbers.then in for loop we have to return value of input(num)’s roman translation.

Roman numbers
two arrays.

while number from numbers does not equals to input(num) then we write that roman num until it does not equals to input(num) it writes for example if input is 8 it writes roman number “V” cause for loop kept going until number was less than or equal to that number so that makes 5 closest to eight and that means for loop keeps writing“V” until somehow 5 becomes 8.to do that we should subtract 5 to 8 it equals 3 so it keeps writing 1 until 3 equals to 0.

That was all bye!

Unlisted

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What is TDZ? from var to let and const ( JavaScript ES6)

Objects — notes

Happy React: Reactions on your website for free

Happy React website screenshot

How Node JS and Puppeteer Assist in Web Scraping Of New York Times News Articles?

Mindblown: Psychological problems solved in an app

How to build a pricing slider — Vue

Create your first nodejs API with express and MongoDB

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store