Palindrome program in c language
Solution of Palindrome program in C language
#include <stdio.h>
#include <string.h>
int main()
{
char text[100];
int b, m, e, len = 0;
gets(text);
while ( text[len] != '\0' )
len++;
e = len - 1;
m = len/2;
for( b = 0 ; b < m ; b++ )
{
if ( text[b] != text[e] )
{
printf("It is not a palindrome.\n");
break;
}
e--;
}
if( b == m )
printf(" It is a Palindrome.\n");
return 0;
}

No comments