Source code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cout<<"ENTER A STRING: ";
cin>>s;
string a;
for(int i=s.length()-1; i>=0; i--)
{
a+=s[i];
}
if(a==s)
{
cout<<"The given string is palindrome"<<endl;
}
else{
cout<<"The given string is not palindrome"<<endl;
}
}
0 Comments
Post a Comment