diff --git a/c/roman-numerals/src/roman_numerals.c b/c/roman-numerals/src/roman_numerals.c index 38eb917..3af6162 100644 --- a/c/roman-numerals/src/roman_numerals.c +++ b/c/roman-numerals/src/roman_numerals.c @@ -3,10 +3,6 @@ #include #include -/* V1: initial working version - * V2 & V3: code simplification - */ - static struct conv_s { unsigned char r; unsigned d; @@ -49,8 +45,8 @@ char *to_roman_numeral(unsigned int n /*, int notation */ ) for (i=mult%5; i>0; --i) res[pos++]=conv[cur].r; } + n-=mult*conv[cur].d; } - n-=mult*conv[cur].d; cur+=2; } if ((to=malloc(pos+1)))