Advertisement
mdgaziur001

Untitled

Aug 31st, 2021
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     char s[10],rev[10];
  6.     int len=0,i,j=0,f=0;
  7.     printf("Enter string: ");
  8.     scanf("%s", s);
  9.     for(i=0; s[i]!='\0'; i++) {
  10.         len=len+1;
  11.     }
  12.     for(i=len-1; i>=0; i--) {
  13.         rev[j++]=s[i];
  14.     }
  15.     rev[j++]='\0';
  16.     for(i=0; i<=len; i++) {
  17.         if(s[i]!=rev[i]) {
  18.             f=1;
  19.             break;
  20.         }
  21.     }
  22.     if(f==0)
  23.         printf("\n%s is a Palindrome.",s);
  24.  
  25.     else
  26.         printf("\n%s is not a Palindrome.",s);
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement