fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int j=0, i=0;
  5. //関数の中だけを書き換えてください
  6. //回文になっているとき1を返す
  7. //回文になっていないとき0を返す
  8. while(s[i+1]!='\0'){
  9. i++;
  10. }
  11. while(j<=i){
  12. if(s[i]!=s[j]){
  13. return 0;
  14. }
  15. i--;
  16. j++;
  17. }
  18. return 1;
  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 5312KB
stdin
girafariga
stdout
girafariga -> 0