C Program to Check whether the Given String is a Palindrome

 

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char sk[15], rp[15];
int i, j;
clrscr();
printf("Enter the string :");
scanf("%s",sk);
i=0;
j=strlen(sk)-1;
while(j>=0)
{
rp[i]=sk[j];
i++;
j--;
}
rp[i]='\0';
if(strcmp(sk,rp)==0)
printf("%s is a palindrome string",sk);
else
printf("%s is not a palindrome string",sk);
getch();
}

 

Output:

C Program to Check whether the Given String is a Palindrome