When the last character matched to the first character of next element of array the output given the last character repeated. What is the reason and what should be the solution ?
#include <stdio.h>
int main(void) {
int i ;
char fact_char[13][2] = {"I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"};
for(i = 0; i < 13; i++){
printf("%s\n", fact_char[i]);
}
return 0;
}
OUTPUT
I
IVV
V
IXX
X
XLL
L
XCC
C
CDD
D
CMM
M

printf("%.2s\n", fact_char[i]);to limit printing to 2 characters.