Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<conio.h>
- int main()
- {
- int n,i,j,k,first,last,flag=1,c,d;
- char str[10];
- scanf("%d",&n);
- getchar();
- for(i=1;i<=n;i++)
- {
- gets(str);
- j=strlen(str);
- first=0;
- last=j-1;
- c=0;d=0;
- for(k=0;k<j;k++)
- {
- printf("Checking position %d and %d >> ",first,last);
- if(str[first]!=str[last])
- {
- printf("Didn't match. So it's not palindrome\n");
- flag=0;
- break;
- }
- else
- printf("matched\n");
- first++;
- last--;
- }
- if(flag==0)
- printf("Case %d: No\n",i);
- else
- printf("Case %d: Yes\n",i);
- }
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement