C Program to find palindrome of number

C Program to find palindrome of number

226
4
SHARE

C Program to find palindrome of number : A palindrome is a word, phrase, number, or other sequence of units that may be read the same way in either direction. Let us consider some examples of palindrome or , for example 12321, 1456541, hannah etc. Now let us see how we can write a to find palindrome of number.

C Program to find Palindrome of Number :

#include<stdio.h>
#include<conio.h>
void main(){
int s=0,d,n,m;
clrscr();
printf("Enter The Figure :\n");
scanf("%d",&n);
m=n;
while(n!=0){
d=n%10;                 //This is the logic block
s=s*10+d;              // here the figure get reversed
n=n/10;

}
if(m==s)
printf("It's A Palindrome");             //In this block the comparison is performed
else                                    // between the reversed figure and the
printf("It's Not A Palindrome");       // original figure i.e n
getch();

}

Let us know if you face any problems with this Palindrome program in C.

4 COMMENTS

  1. Thank you, I have recently been looking for info approximately this subject for ages and yours is the best I have came upon so far. But, what concerning the conclusion? Are you certain concerning the source?

  2. Hiya very nice site!! Man .. Beautiful .. Wonderful .. I will bookmark your site and take the feeds alsoI’m satisfied to find a lot of useful information right here in the publish, we’d like develop extra strategies in this regard, thank you for sharing. . . . . .

  3. Doesn’t hold for 12345654321 or any bigger palindromes. Can you long long int or something to correct this? Has me going nuts here :/

LEAVE A REPLY