C Program To Check Whether The Given String is a Palindrome

C Program to Check whether the Given String is a Palindrome

#include<stdio.h>
#include<string.h>

main()
{

char str1[20];
char str2[20];
int i;

printf("Enter str1:\n");
scanf("%s",str1);

strcpy(str2,str1);

strrev(str1);

i=strcmp(str1,str2);

if(i==0)
{

printf("palindrome string:\n");

}
else

printf("string Not palindrome");

}

Related Posts