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