fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int sn,p,i;
  5. for(sn=0;s[sn]!='\0';sn++){}
  6. p=sn/2;
  7. int sn2=sn-1;
  8. for(i=0;i<p;i++,sn2--){
  9. if(s[i]!=s[sn2]) return 0;
  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. }
  20.  
Success #stdin #stdout 0.01s 5288KB
stdin
repaper 
stdout
repaper -> 1