Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* C programme to check if a string is palindrome or not */
- #include<stdio.h>
- #include<string.h>
- int main(void)
- {
- char a[999];
- gets(a);
- int x=strlen(a);
- int counter=0;
- int i;
- for(i=0;i<=x;i++)
- {
- if(a[i]==a[x-1])
- {
- counter++;
- x--;
- }
- }
- if(i==counter)
- {
- printf("YES\n");
- }
- else
- {
- printf("NO\n");
- }
- return 0;
- }
- /*
- Check if a string is palindrome or not.
- Sample input: ulala
- Sample output: NO
- Sample input: abcba
- Sample output: YES
- */
Add Comment
Please, Sign In to add comment