fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int i=0;
  5. int j=0;
  6. while (s[i] != '\0')
  7. {i++;}
  8. i--;
  9. while(j<i)
  10. {if(s[i]!=s[j]){
  11. return 0;
  12.  
  13. }
  14. j++;
  15. i--;
  16. //関数の中だけを書き換えてください
  17. //回文になっているとき1を返す
  18. //回文になっていないとき0を返す
  19. }
  20. return 1;
  21. }
  22.  
  23. //メイン関数は書き換えなくてよいです
  24. int main(){
  25. char s[100];
  26. scanf("%s",s);
  27. printf("%s -> %d\n",s,isPalindrome(s));
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 5320KB
stdin
sdfgh
stdout
sdfgh -> 0