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