|
|
/*Program to check if a given word is a palindrome*/ #include<iostream.h> #include<conio.h> void main() { char word[30]; int size=1,flag,space=0; clrscr(); cout<<"Enter any word"; cin.getline(word,80); for(int len=0;word[len]!='\0';++len) { ++space; } cout<<space; for(int j=0,k=size;j<k;++j,--k) { if(word[j]==word[k]) flag=0; } if(!flag) { cout<<"It is a palindrome"; } else { cout<<"It is not a palindrome"; } getch(); }
|