//Using C++
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char word[10],word2[10];
int n;
cout<<"Enter string:";
cin>>word;
strcpy(word2,word);
strrev(word);
if(stricmp(word,word2)==0)
cout<<"\nPalindrome.";
else
cout<<"\nNot Palindrome!";
getch();
clrscr();
}
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char word[10],word2[10];
int n;
cout<<"Enter string:";
cin>>word;
strcpy(word2,word);
strrev(word);
if(stricmp(word,word2)==0)
cout<<"\nPalindrome.";
else
cout<<"\nNot Palindrome!";
getch();
clrscr();
}
No comments:
Post a Comment