#include<iostream>
      using namespace std;
      //main program
      int main ()
      {
          //variables initialization
          int num, reverse = 0, rem, temp;
          cout <<"Enter a number: "; 
          cin >> num;
          temp = num;
          //loop to find reverse number
          while(temp != 0)
          {
              rem = temp % 10;
              reverse = reverse * 10 + rem;
              temp /= 10;
          };
          // palindrome if num and reverse are equal
          if (num == reverse)
              cout << num << " is Palindrome";
          else
              cout << num << " is not a Palindrome";
      }
      
      Cpp language logo

      palindrome number

      0

      0

      avatar
      Ayush Gupta

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.