Palindrome or not in C++ - 👑 सार्थक मुंड S3 🤴🏻

Palindrome or not in C++

Palindrome or not in C++

Write a program (WAP) in C++ to calculate number is Palindrome or not.

#include <iostream>
using namespace std;
int main()
{
    int n, num, digit, rev = 0;
    cout << "Enter a  Number:\n ";
    cin >> num;
    n = num;
    do
    {
       digit = num % 10;
       rev = (rev * 10) + digit;
       num = num / 10;
    }
    while (num != 0);
    cout << " Reverse of the number is: \n" << rev<<"\n";
    if (n == rev)
       cout << "This is a Palindrome Number.";
    else
       cout << "This is not a Palindrome Number.";
    return 0;
}

Out Put  :-

1. When number is Palindrome number
Palindrome or not in C++
 2. When number is not a palindrome number
Palindrome or not in C++
Must Read :-
  1. Blogger Tutorial
  2. C Programs
  3. C++ Programs
  4. Java Programs
  5. Python Programs
  6. Programming Notes 
  7. Questions & Answers
  8. My Codes : HTML, CSS & JS
  9. All Subject Notes
Previous article
Next article

Leave Comments

Post a Comment

Articles Ads

Articles Ads 1

Articles Ads 2

Advertisement Ads