What is Palindrome?
#include <iostream>
#include <conio.h> #include <string.h> using namespace std; int main() { char strn[80]; int i,j,flag=0,len; cout<<"Enter the string:"; cin.getline(strn,80); len=strlen(strn); for(i=0,j=len-1;i<=(len/2);++i,--j) { if(strn[i]==strn[j]) flag=1; } if(flag) cout<<" the given string is a Palindrome"; else cout<<"The given string is NOT a palindrome"; }
0 Comments