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