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