Computer Science, asked by priyasri99, 11 months ago

write a simple c++ program for palindrome.​

Answers

Answered by shridevimishra68
0

Answer:The dev- C++ IDE provides an integrated development environment to write ,edit,compile and runs C program

Explanation:

Answered by sushiladevi4418
0

Answer:

write a simple c++ program for palindrome.​

Explanation:

#include <iostream>

using namespace std;

int main()

{

    int n, num, digit, rev = 0;

    cout << "Enter a positive number: ";

    cin >> num;

    n = num;

    do

    {

        digit = num % 10;

        rev = (rev * 10) + digit;

        num = num / 10;

    } while (num != 0);

    cout << " The reverse of the number is: " << rev << endl;

    if (n == rev)

        cout << " The number is a palindrome.";

    else

        cout << " The number is not a palindrome.";

   return 0;

}

Output

Enter a positive number: 121

The reverse of the number is: 121

The number is a palindrome.

Similar questions