Advertisement
faisal95

Palendrame check

Jul 2nd, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. /* Palendrame check */
  2.  
  3. #include<stdio.h>
  4. #include<string.h>
  5.  
  6. int main ()
  7. {
  8. int flag=1,i=0,j,l;
  9. char x[100];
  10. gets(x);
  11. l=strlen(x);
  12. j=l-1;
  13. for(i=0; i<l/2; i++, j--)
  14. {
  15. if(x[i]!= x[j])
  16. {
  17. flag=0;
  18. break;
  19. }
  20. }
  21. if(flag==1)
  22. {
  23. puts("palendrame");
  24. }
  25. else {
  26. puts(" not palendrame");
  27. }
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement