/*Check if a phrase is Palindrome*/
#include<stdio.h>
#include<string.h>
void main() {
char phr[50], phrs[50];
int i, j;
printf("\nEnter the phrase: ");
gets(phr);
i = strlen(phr);
for (j = 0; j < i; j++) {
phrs[j] = phr[i - 1 - j];
}
if (strcmpi(phr, phrs) == 0)
printf("\nIt is a palindrome");
else
printf("\nIt is not a palindrome");
}
WHAT'S NEW?
Loading...
A number is palindrome, if number remains same after reversing it's digits.
ReplyDeleteFor Example
432234 is palindrome number, but 54321 is not a palindrome number. We can also check for palindrome string using recursion.