From b6127c87a727d541c9539f925cf2619f2bb536a6 Mon Sep 17 00:00:00 2001 From: lucaferranti Date: Fri, 1 Mar 2024 01:21:14 +0200 Subject: [PATCH] tweak --- exercises/practice/roman-numerals/.meta/reference.chpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/exercises/practice/roman-numerals/.meta/reference.chpl b/exercises/practice/roman-numerals/.meta/reference.chpl index 6af14fb..c6908e4 100644 --- a/exercises/practice/roman-numerals/.meta/reference.chpl +++ b/exercises/practice/roman-numerals/.meta/reference.chpl @@ -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; }