PROGRAM TO FIND WHETHER A STRING IS PALINDROME OR NOT

/*PROGRAM TO FIND WHETHER A STRING IS PALINDROME OR NOT*/
#include<stdio.h>
#include<conio.h>
void main()
{
char a[15];
int length,i,count=0,j;
clrscr();
printf(“Enter any string: “);
gets(a);
length=strlen(a);
j=length-1;
for(i=0;i<length;i++,j–)
{
if(a[i]==a[j])
count++;
}
if(count==length)
printf(“Given string is palindrome”);
else
printf(“Given string is not palindrome”);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *