program that reads in a five-digit integer and determines whether or not it is a palindrome
Code:
Enter a five-digit number ( -1 to end ): 18181
18181 is a palindrome
Enter a five-digit number ( -1 to end ): 16738
16738 is not a palindrome
Enter a five-digit number ( -1 to end ): -1
any one can help me on making this program?
i have make it but dont quite get...
this is my code that i have used
Code:
#include<stdio.h>
#include<string.h>
void main()
{
char strsrc[5];
char strtmp[5];
printf("\n Enter a five-digit number ( -1 to end ): "); gets(strsrc);
strcpy(strtmp,strsrc);
strrev(strtmp);
if(strcmp(strsrc,strtmp)==0)
printf("\n %s is a palindrome\n",strsrc);
else
printf("\n %s is not a palindrome\n",strsrc);
}
the program end after test 1 int, and -1 to end the program dont work
can any one help?