0
Code Coach-----The spy life.......what is wrong with my code....?
#include <stdio.h> #include <ctype.h> #include <string.h> int main() { char inp[100], nw[100]; gets(inp); int i, n, x, y; n = strlen(inp); for(i=0;i<n;i++){ nw[i] = inp[n-i]; } for(i=0;i<n;i++){ x = isalpha(nw[i]); y = isspace(nw[i]); if(x != 0 || y != 0){ printf("%c",nw[i]); } } return 0; }
3 Answers
+ 2
Check out for the constraints given in the question. You have to ensure to remove everything that isn't a letter or space from the original message and flip it around,
So the logic would be like
if((name[j]>=97 && name[j]<=123) || (name[j]>=65 && name[j]<=91))
{
printf("%c",name[j]);
}
else if(name[j]==32)
{
printf(" ");
}
+ 2
yodha gopal read the code coach carefully
You have to remove all the numbers and other special characters from the string, in order to do that refer to Aditya 's code
+ 1
Aditya thanks for your reply......but i didn't understand what you meant