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