Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<conio.h>
  4.  
  5. int main()
  6. {
  7. int n,i,j,k,first,last,flag=1,c,d;
  8. char str[10];
  9.  
  10. scanf("%d",&n);
  11. getchar();
  12. for(i=1;i<=n;i++)
  13. {
  14. gets(str);
  15. j=strlen(str);
  16. first=0;
  17. last=j-1;
  18. c=0;d=0;
  19. for(k=0;k<j;k++)
  20. {
  21. printf("Checking position %d and %d >> ",first,last);
  22. if(str[first]!=str[last])
  23. {
  24. printf("Didn't match. So it's not palindrome\n");
  25. flag=0;
  26. break;
  27. }
  28. else
  29. printf("matched\n");
  30. first++;
  31. last--;
  32. }
  33. if(flag==0)
  34. printf("Case %d: No\n",i);
  35. else
  36. printf("Case %d: Yes\n",i);
  37. }
  38. getchar();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement