Search This Blog

C program for checking a string is palindrome or not

//coded by Z
#include<stdio.h>
void main()
{
char st[25];
int i,j,flag=1;
clrscr();
printf("\nEnter a word\n\n");
gets(st);
for(i=0;st[i]!='\0';i++)
for(j=1,i=0;st[j]!=st[i]&&i<j;i++,j++)
{
flag=0;
break;
}
if(flag==1)
printf("\nThe word is a palindrome");
else
printf("\nThe word is not a palindrome");
getch();
}

No comments:

Post a Comment