Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaferranti committed Feb 29, 2024
1 parent 219866b commit b6127c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions exercises/practice/roman-numerals/.meta/reference.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ module RomanNumerals {

proc toRomanNumeral(in n: int): string {
var res : string = "M" * (n / 1000);
n = n % 1000;
n %= 1000;

res += helper(n / 100, ("C", "D", "M"));
n = n % 100;
n %= 100;

res += helper(n / 10, ("X", "L", "C"));
n = n % 10;
n %= 10;

res += helper(n, ("I", "V", "X"));
return res;
}
Expand Down

0 comments on commit b6127c8

Please sign in to comment.