Advertisement
saira12tabassum19

Untitled

Jul 1st, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6. char a[100], b[100];
  7.  
  8. printf("Enter a string to check if it is a palindrome\n");
  9. gets(a);
  10.  
  11. strcpy(b, a); // Copying input string
  12. strrev(b); // Reversing the string
  13.  
  14. if (strcmp(a, b) == 0) // Comparing input string with the reverse string
  15. printf("The string is a palindrome.\n");
  16. else
  17. printf("The string isn't a palindrome.\n");
  18.  
  19. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement