From 2561c6543d427289634eb0603ffd9ebb9b3b9c5e Mon Sep 17 00:00:00 2001 From: Mayanksingla139 <55097726+Mayanksingla139@users.noreply.github.com> Date: Fri, 16 Oct 2020 00:20:05 +0530 Subject: [PATCH] Read me # To check whether a number is in palindrome or not --- C++/program-19 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 C++/program-19 diff --git a/C++/program-19 b/C++/program-19 new file mode 100644 index 00000000..a18f2dd0 --- /dev/null +++ b/C++/program-19 @@ -0,0 +1,23 @@ +#include +using namespace std; +int main() +{ + int num, temp, digit, rev = 0; + + cout << "Enter a positive number: "; + cin >> num; + temp = num; + while (num != 0){ + digit = num % 10; + rev = (rev * 10) + digit; + num = num / 10; + } + cout << "The reverse of the number is: " << rev << endl; + if (temp == rev){ + cout<<"The number is a palindrome."; + } + else{ + cout << "The number is not a palindrome."; + } + return 0; +}