Back To C++ Single Dimensional Arrays Index
//program to input a string(char array) and check whether the string is palindrome or not (radar is a palindrome and radaw is not a palindrome) #include
#include
#include
#include
void main() { char str1[10]; int i,l; int palin=1; clrscr(); cout<<"\nenter string 1"; gets(str1); l=strlen(str1); for(i=0;i<=l/2;i++) { if(str1[i]!=str1[l-i-1]) { palin=0; break; } } if(palin==0) { cout<<"\nstring is not palindrome"; } else { cout<<"\nstring is palindrome "; } getch(); }