Code Coach-----The spy life.......what is wrong with my code....? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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; }

7th Apr 2021, 12:57 PM
yodha gopal
yodha gopal - avatar
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(" "); }
7th Apr 2021, 1:09 PM
Aditya
Aditya - avatar
+ 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
7th Apr 2021, 1:27 PM
Namit Jain
Namit Jain - avatar
+ 1
Aditya thanks for your reply......but i didn't understand what you meant
7th Apr 2021, 1:22 PM
yodha gopal
yodha gopal - avatar