Palindrome

Hi friends today i'm going to explain about "Palindrome". Palindrome is a string which is equal to reverse of same string. i.e., "madam" is palindrome because if you reverse the string the same string 'll come.
i'm sure that you'll understood from above what's palindrome. Now i'm going to implement in program. but note that we shouldn't use reverse string function and strcmp function. because if you use ,it's simple program.

CODING:
#include< stdio.h >
#include< conio.h >
void main()
{
char a[]="mam";
char *b;
int i=0,j=0,status=1;
clrscr();
b=&a[0];
for(i=0;*b!='\0';i++,b++);
b--;
while(a[j]!=0)
{
if(a[j]!=*b)
{
status=0;
break;
}
else
{
b--;
j++;
}
}
if(status==0)
printf("!palindrome");
else
printf("palindrome");
getch();
}

Related Posts