// C Program to check given
string is Palindrome or not.
#include <stdio.h>
#include <string.h>
int main()
{
char a[10], b[10];
printf("Enter your string:\n");
gets(a);
strcpy(b,a);
strrev(b);
if (strcmp(a,b) == 0)
printf("Entered string is a
palindrome.\n");
else
printf("Entered string is not a
palindrome.\n");
return 0;
} |
Output of the
Program:
Enter your string:
ABA
Entered string is a palindrome.
No comments:
Post a Comment