+ 2
No numericals problem
Need help finding WTH is wrong!! The code works for 5/6 test https://code.sololearn.com/cL0duA4WTo4C/?ref=app
1 Respuesta
+ 9
#include <stdio.h>
int main ()
{
char str[105]={};
scanf ("%[^\n]", &str); getchar ();
for (int x=0; str[x]!='\0'; x++)
{
if (str[x]=='1' && str[x+1]=='0')
{
printf ("ten");
x++;
}
else if (str[x]=='0') printf ("zero");
else if (str[x]=='1') printf ("one");
else if (str[x]=='2') printf ("two");
else if (str[x]=='3') printf ("three");
else if (str[x]=='4') printf ("four");
else if (str[x]=='5') printf ("five");
else if (str[x]=='6') printf ("six");
else if (str[x]=='7') printf ("seven");
else if (str[x]=='8') printf ("eight");
else if (str[x]=='9') printf ("nine");
else printf ("%c", str[x]);
}
return 0;
}