Program to find palindrome in a string?

1 answer

Answer

1026761

2026-08-20 15:30

+ Follow

#include
#include
void main()
{
char str1[80];
int i,j,flag=1;

printf("enter a Word:");
gets(str1);
for(i=0,j= (strlen(str1)-1);i<=(strlen(str1)-1),j>=0;i++,j--)
{
if(str1[i]!=str1[j])
flag=0;
}
if(flag)
printf("palindrome");
else
printf("not a palindrome");
}

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.