View Single Post
  #15   Spotlight this post!  
Unread 17-09-2008, 13:18
StormRoBoT StormRoBoT is offline
Registered User
no team
 
Join Date: Sep 2008
Location: Malaysia
Posts: 1
StormRoBoT is an unknown quantity at this point
Red face C Programming Homework Help Needed

help on palindrome

i have make a program that can trace palindrome number but i need it to loop over and over again till i keyin -1 then only the program terminate


this is the 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);
}
any one can help?