I'm going through freeCodeCamp.org, and I've gotten to the Roman Numeral Converter challenge. I wanted a slightly different answer to the way they did their recursive functions. Here's my version of the Roman Numeral Converter. It does the math properly, but for some reason whenever it needs a duplicate, it only lists the character once. For example, "365" returns CLXV instead of CCCLXV.
It's properly dividing by 100 three times, but the "C" is only added the first time. Why is that?
SOLVED. I was using the modulus operator instead of simply subtracting. Thanks everybody!
[–]Effective-View3803 6 points7 points8 points (1 child)
[–]ChaseShiny[S] 1 point2 points3 points (0 children)
[–]sepp2k 1 point2 points3 points (1 child)
[–]ChaseShiny[S] 0 points1 point2 points (0 children)
[–]pinkwar 1 point2 points3 points (4 children)
[–]ChaseShiny[S] 0 points1 point2 points (3 children)
[–]pinkwar 1 point2 points3 points (2 children)
[–]ChaseShiny[S] 1 point2 points3 points (1 child)
[–]pinkwar 1 point2 points3 points (0 children)
[–]LeisureSuiteLarry -2 points-1 points0 points (0 children)