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