Trending This Week:

test

Post Top Ad

Your Ad Spot

Saturday, June 11, 2022

C++ program to check weather the number is palindrome or not.



A palindromic number (also known as a numeral palindrome or a numeric palindrome) is a number (such as 16461) that remains the same when its digits are reversed.


 C++ program to check weather the number is palindrome or not. 


#include <iostream>
using namespace std;

int main() 
{
    int n,r,sum=0,rev=0;
    cout<<"Enter Number : ";
    cin>>n;
    rev=n;
    while(n!=0)
    {
        r=n%10;
        sum=sum*10+r;
        n/=10;
    }
    if(sum==rev)
        cout<<rev<<" is Pelimdron Number";
    else
        cout<<rev<<" is Not a Pelimdron Number";
    return 0;
}
Output :




No comments:

Post a Comment

Post Top Ad

Your Ad Spot