Palindrome:
Palindromes are words or phrases that read the same in both directions.
Some examples of common palindromic words: civic, dewed, deified, dad, mom, devoved, hannah, repaper, radar, level, rotor, kayak, reviver, racecar, redder, madam, redder, bob, pop, tot, malayalam, noon, rotator, rotavator, stats, solos, tenet and refer.
Program:
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char s[50],m[50];
int p=1,i;
clrscr();
cout<<"Enter the string: ";
cin>>s;
strcpy(m,s);
strrev(m);
for(i=0;i<=strlen(s)-1;i++)
{
if(*(m+i)!=*(s+i))
{
p=0;
break;
}
}
if(!p)
cout<<"\n"<<s<<" is not a Palindrome";
else
cout<<"\n"<<s<<" is a Palindrome";
getch();
}
ReplyDeletenice article for beginners.thank you.
javacodegeeks
welookups