Check the number palindrome and not palindrome


Check the number palindrome and not palindrome. By using some simple steps we can solve this problem i.e Check the number palindrome and not palindrome. We just providing the simple steps for solving this problem.
Description
In this program we check Check the number palindrome and not palindrome. Until we will check a number condition true (n>0) other wise we check (n1==n) then this statement will number is palindrome or not.


#include<stdio.h> #include &lt;conio.h > void main ( ) { int n, rev, r, n1 ; clrscr ( ) ; printf ( “Enter a Numebr!\n” ) ; scanf ( “%d”,&n ) ; n1 = n ; rev = 0 ; while (n > 0) { r = n % 10 ; rev = rev * 10 + r ; n = n / 10 ; } if ( rev == n1 ) { printf ( “ The Numebr is palindrome %d” ,rev ) ; } else { printf ( “ The Numbebr is Not a palindrome %d ”, rev ) ; } } getch ( ) ; }

Output:-

Enter a Number! 121
The Numebr is palindrome 121
Enter a Number! 123
The Number is not a palindrome