Number PAlindorme

// Online C++ compiler to run C++ program online

#include <iostream>

using namespace std;


int rev(int n){

    int ans=0;

    while(n){

        ans=ans*10+(n%10);

        n/=10;

    }

    return ans;

}

int main() {

    int n;

    cin>>n;

    int a=rev(n);

    cout<<a<<endl;

    if (n==a){

        cout<<"Palindrome";

        

    }

    else{

        cout<<"Not Palindrome";

    }

    

    


    return 0;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings