fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int isPalindrome(char s[]) {
  5. int len = strlen(s);
  6. for (int i = 0; i < len / 2; i++) {
  7. if (s[i] != s[len - i - 1]) {
  8. return 0;
  9. }
  10. }
  11. return 1;
  12. }
  13.  
  14. int main() {
  15. char s[100];
  16. scanf("%s", s);
  17. printf("%s -> %d\n", s, isPalindrome(s));
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5280KB
stdin
girafarig
stdout
girafarig -> 1