WHAT'S NEW?
Loading...

C Program to Check if a phrase is Palindrome


/*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");
}

1 comment: Leave Your Comments

  1. A number is palindrome, if number remains same after reversing it's digits.
    For Example
    432234 is palindrome number, but 54321 is not a palindrome number. We can also check for palindrome string using recursion.

    ReplyDelete