16/*Write a C progrm to check whether given string is palindrome or not.*/


#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
char s[30];
int i,j,len,flag=1;
clrscr();
printf(“\n Enter the string:\n”);
gets(s);
len=strlen(s);
for(i=0,j=len-1;i<=len/2;i++,j–)
{
if(s[i]!=s[j])
{
flag=0;
break;
}
}
if(flag)
printf(“\n String is a palindrome.\n”);
else
printf(“\n String is not a palindrome.\n”);
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s