#include "stdio.h"
#include "conio.h"
void main()
{
long num,reverse=0,digit,temp;
clrscr();
printf("Enter Number: ");
scanf("%ld",&num);
temp=num; /* saving the input to a temporary variable */
do
{
digit=num%10; /* Extracting Last Digit */
reverse=reverse*10+digit; /* to bring the digit to first decimal place */
num=num/10; /* to exclude last digit */
} while(num!=0);
printf("\n%ld ",reverse);
if(temp==reverse)
printf("Palindrome.");
else
printf("Not Palindrome.");
getch();
}
Friday, June 26, 2009
PROGRAM TO CHECK THE PALINDROME OF NUMBERS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment