A string is said to be palindrome if reverse of the string is same as string

source file name: palindr2.C

#include<string.h>

void main()

{

char str1[20];

char str2[20];

char str[20];

int n;

clrscr();

printf("\n Enter a String: ");

scanf("%s",str1);

strcpy(str,str1);

strcpy(str2,strrev(str1));

n=strcmpi(str2,str);

if(n==0)

printf("\n Given string is Palindrome.");

else

printf("\n Given string is not Palindrome.");

getch();

}

output:

1. Enter a String : madam

Given string is Palindrome.

2. Enter a String : welcome

Given string is not Palindrome.