Palindrome number- A palindromic number is a number that remains the same when its digits are reversed.
C++ code-
#include <iostream.h> void main() { int n,a,b,rev=0; cout<<"Enter number : "; cin>>n; b=n; while(n>0) { a=n%10; rev=rev*10+a; n=n/10; } cout<<"\nReverse number : "<<rev; if(rev==b) cout<<"\nPalindrome number."; else cout<<"\nNot a Palindrome number."; }
OUTPUT- Enter number :164461 Reverse number :164461 palindrome number.
click here for more c++ codes.
Similar posts-
C++ program to find the average.
Comments :
Post a Comment