Write a C program to check whether the given number is palindrome or not.


#include<stdio.h>
#include<string.h>
main()
{
int i,j,len;
char str[80],rev[80];
printf("\n\n\t\t CHECK FOR PALINDROME\n");
printf("\t\t *********************\n");
printf("\nINPUT:");
printf("\n******\n");
printf("Enter a word or text:");
gets(str);
len=strlen(str);
printf("OUTPUT:\n");
printf("*******\n");
printf("\n Length of the String is %d \n",len);
for (i=len-1,j=0;i>=0;i--,j++)
rev[j]=str[i];
rev[j]='\0';
printf("\n Original string:%s",str);
printf("\n Reversed string:%s",rev);
if (strcmp(str,rev)==0)
printf("\n The String%s is a Palindrome",str);
else
printf("\n\n The String %s is Not a Palindrome",str);
getch();
}

0 comments:

Feel free to contact the admin for any suggestions and help.