Advertisement
pranto_95

Palindrome

Jul 2nd, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(){
  4.     int flag,i=0,j,l;
  5.     char x[100];
  6.     scanf("%s",x);
  7.     l=strlen(x);
  8.     j=l-1;
  9.     for(i=0;i<l/2;i++,j--){
  10.         if(x[i]!=x[j]){
  11.                 flag=0;
  12.                 break;
  13.         }
  14.     }
  15.     if (flag==0){
  16.             printf("Not a Palindrome");
  17.     }
  18.     else{
  19.             printf("Palindrome");
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement