0
About extra-terrestrials problem
I'm stuck with this problem . 2/5 tests failed. Please help me what is wrong with this code #include <stdio.h> #include <string.h> int main() { int i,n; char b[100],a[100]; scanf("%[^\n]%*c",b); n=strlen(b); for (i=0;i<n;i++) { a[n-1-i]=b[i];} printf("%s",a); return 0; }
3 Réponses
+ 1
Seems fine. May be adding extra space.
Since input only a word, %s is enough in scanf. So
Try with scanf("%s", b);
0
Thanks that fixed the problem