top of page
Lakhan Dhakad

C++ Program to check Palindrome Word

A palindrome is a word, phrase, or sequence that reads the same as forwards as well as backward.

 

Implementation:

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
char str1[10],str2[10];
int len,i;
cout<<"Enter word :";
gets(str1);
strcpy(str2,str1);
len=strlen(str1);
for(i=0;i<=(len/2);++i)
{
int temp=str1[i];
str1[i]=str1[len-1-i];
str1[len-1-i]=temp;
}
if(strcmpi(str1,str2)==0)
cout<<"\nGiven word is a palindrome";
else
cout<<"\nGiven word is not a palindorme";
getch();
}
 

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Follow Programmers Door for more.

6 views0 comments

Recent Posts

See All

留言


bottom of page