Advertisement
mhrabbi

P8.WAP to check whether an givenstring is a palindrom or not

Jul 23rd, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     char a[100],b[200];
  6.     int comp;
  7.  
  8.     printf("Enter String: ");
  9.     gets(a);
  10.  
  11.     strcpy(b,a);
  12.     strrev(b);
  13.  
  14.     comp=strcmp(a,b);
  15.  
  16.     if(comp==0)
  17.     {
  18.         printf("This is a palindrome");
  19.     }
  20.     else
  21.     {
  22.         printf("This is not a palindrome");
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement