Advertisement
murad45

Programming task - 02

Apr 26th, 2021
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <string.h>
  2.  
  3. int main()
  4. {
  5.     char s[1000];
  6.     int i,n,c=0;
  7.  
  8.     printf("Enter  the string : ");
  9.     gets(s);
  10.     n=strlen(s);
  11.  
  12.     for(i=0;i<n/2;i++)
  13.     {
  14.         if(s[i]==s[n-i-1])
  15.         c++;
  16.  
  17.     }
  18.     if(c==i)
  19.         printf("string is palindrome");
  20.     else
  21.         printf("string is not palindrome");
  22.  
  23.  
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement