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