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