+ 1
No numerals test case 3 passed
8 Réponses
+ 1
Vishal
If there is 10 then it's doesn't mean it is one zero. It should be "ten". So first you have to replace 10 with "ten"
0
#include <stdio.h>
#include <string.h>
int main() {
char arr[100];
fgets(arr, sizeof(arr), stdin);
int s= strlen(arr);
for(int i=0; i< s; i++){
if(arr[i] >= 48 && arr[i]<=57){
goto num;
}
printf ("%c", arr[i]);
num:
if(arr[i] >= 48 && arr[i]<=57){
switch (arr[i])
{
case '0':
printf ("zero");
break;
case '1':
printf ("one");
break;
case '2':
printf ("two");
break;
case '3':
printf ("three");
break;
case '4':
printf ("four");
break;
case '5':
printf ("five");
break;
case '6':
printf ("six");
break;
case '7':
printf ("seven");
break;
case '8':
printf ("eight");
break;
0
case '8':
printf ("eight");
break;
case '9':
printf ("nine");
break;
case '10':
printf ("ten");
break;
}
}
}
return 0;
}
0
Test case 3 not passed
0
YUGRAJ
STILL NOT GETTING
if(arr[i] >= 48 && arr[i]<=57){
goto num;
}
printf ("%c", arr[i]);
num:
if(arr[i] >= 48 && arr[i]<=57){
if(arr[i] == '1' && arr[i+1]== '0'){
printf ("ten");
}
switch (arr[i])
{
case '0':
printf ("zero");
break;
case '1':
printf ("one");
0
Yeah right now just put i++; and continue after printing ten
0
YUGRAJ
BUDDY, I have tried it but it didn't work out also changed position sometimes of the statement but nothing happened.
- 1
For 10 you have to do two things it should be above all cases and second you need to check two characters so i recommend use if statement before switch and check if current is 1 and next is 0 if so then put ten in answer and increase i one time extra and then continue