Saturday, October 8, 2011

C Program to check for Palindrome Number

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



Program


#include<stdio.h>
#include<conio.h>
void main()
{
int num,r,sum=0,temp;
clrscr();
printf("\nEnter a number:");
scanf("%d",&num);
temp=num;
while(num)
{
r=num%10;
num=num/10;
sum=(sum*10)+r;
}
if(temp==sum)
printf("\n%d is a palindrome",temp);
else
printf("\n%d is not a palindrome",temp);
getch();
}


Output...

0 comments:

Post a Comment

About Me