#include<stdio.h>
int main(){
int numero,unidade,dezena,centena;
char *unidades[]={"I","II","III","IV","V","VI","VII","VIII","IX"};
char *dezenas[]={"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
char *centenas[]={"C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
scanf("%d",&numero);
unidade=(numero%100)%10;
dezena=(numero%100)/10;
centena=numero/100;
if (centena){
printf("%s",centena[centena-1]);
}
if (dezena){
printf("%s",dezena[dezena-1]);
}
if (unidade){
printf("%s",unidade[unidade-1]);
}
printf("\n");
return 0;
}
So, I was trying to make the URI 1960, which consists of converting a number into a decimal base for a number in Roman numerals, but I'm having trouble printing the string . p>
The following error occurs:
subscripted value is neither array nor pointer nor vector printf ("% s", centena [1]);
The same goes for tens and units.