/* Program for checking and displaying whether the Entered Number is "Palindrome" or NOT. Number whose reverse is equal to itself is called Palindrome number. */ #include <iostream> using namespace std; int main() { int n, a, reverse = 0, rem; cout << "Enter Number?\t"; cin >> n; a = n; while (a != 0) { rem = a % 10; reverse = reverse * 10 + rem; a = a / 10; //or a/=10; } if (reverse == n) cout << "The entered number is Palindrome\n"; else cout << "The entered number is not Palindrome\n"; return 0; }
This blog is about coding in some commonly used "High Level Languages" like C, C++, Java etc. At first, I will post here basic programs written in C++ language only.
Friday, November 21, 2014
C++ Program for "Palindrome" Numbers
Labels:
C++ Programs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment