PROGRAM TO FIND PALINDROME STRING
EX:
enter the string
malayalam
malayam is a palindrome.
PROGRAM:
#include <stdio.h>
int main()
{
char s[30];
char t[30];
int i, j, c, count=0;
printf("enter the string\n");
scanf("%s",s);
for(i=0; s[i] !='\0'; i++);
c=i;
for (c=i-1, j=0; c>=0; c--,j++)
{
t[j] =s [c];
}
for(i=0;s[i] != '\0'; i++)
{
if(t[i] !=s[i])
{
count++;
}
}
if (count==0)
printf("%s is a palindrome",s);
else
printf("%s is not a palindrome",s);
return 0;
}
LEARN WITH JAGADEESH
copyright© to jagadeesh
Thanks for visiting
ReplyDeletePost a Comment