C++ programming language part-83 Programming Logic and Technique:
Ex: 19_3 Palindrome String
Programming
Logic and Technique:
{ char string[10];
int i,j;
char k=1;
display
"type the string ";
accept>> string ;
for(i=0;a[i]!='\0';i++);
i--;
for(j=0;i>=0;j++,i--)
{
if(string [j]== string [i])
k=0;
break;
}
if(k=0)
display"
Your string is Palindrome";
else
display
" Your string isn't Palindrome";
Program
Ex_19_22
/ //palindrome
(arraydemo.c)
#include
#include
void main()
{
clrscr(); // To clean the screen
char
a[10];//array of size 10 defined
int i,j;
char k=1;
cout<<"type
the string "<<"\n";
cin>>a;
for(i=0;a[i]!='\0';i++);
i--;
for(j=0;i>=0;j++,i--)
{
if(a[j]==a[i])
k=0;
break;
}
if(k==0)
cout<<"
Your string is
Palindrome"<
else
cout<<" Your string isn't Palindrome"<
}