fork download
  1. # include <stdio.h>
  2.  
  3. int isPalindrome(char s[]){
  4. int start=0;
  5. int end=0;
  6. while(s[end]!=0)
  7. {
  8. end++;
  9. }
  10. end--;
  11. while (start < end) {
  12. if (s[start] != s[end]) {
  13. return 0;
  14.  
  15. }
  16. start++;
  17. end--;
  18. }
  19. return 1;
  20. }
  21. int main(){
  22. char s[100];
  23. scanf("%s",s);
  24. printf("%s -> %d\n",s,isPalindrome(s));
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 5284KB
stdin
oreo
stdout
Standard output is empty