Home » NO IDEA » Palindrome Number

Palindrome Number

Blog Stats

  • 13,912 hits
January 2013
M T W T F S S
« Dec   Mar »
 123456
78910111213
14151617181920
21222324252627
28293031  
Definition of Palindrome number or What is palindrome number?


A number is called palindrome number if it is remain same when its digits are reversed. For example 121 is palindrome number. When we will reverse its digit it will remain same number i.e. 121
Palindrome numbers examples: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191 etc.
// Palindrome number using while loop
#include<stdio.h>
int main()
{
int num,r,rev,temp;
rev=0;
printf("\n Enter the Number ");
scanf("%d",&num);
temp=num;
while(num>0)
{
r=num%10;
rev=rev*10+r;
num=num/10;
}
printf("%d",rev);
if(rev==temp)
{
printf("\n It is palindrome number ");
}
else
{
printf("\n It is not a palindrom number ");
}
return 0;
}

Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: