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