Example: 121 and 12321 are palindrome numbers.
#include <stdio.h>
#include<string.h>
int main ()
{
char number[10],reverse[10];
puts("Enter your number:");
gets(number);
strcpy(reverse,number);
strrev(number);
printf("Your original number is :%s\n",number);
printf("Reverse number is: %s\n", reverse);
if(strcmp (number,reverse) == 0 )
printf("Its Palindrome");
else
printf("Not a Palindrome number");
return 0;
}
/* Output
Enter your number:
121
Your original number is :121
Reverse number is: 121
Its Palindrome
*/
No comments:
Post a Comment