Site Loader
Get a Quote

palindrome number program in c++

palindrome number program: –Hi Readers, In this tutorial we create a program in c++ to check whether a number is a palindrome or not.Here we start the topic on how to make palindrome number program in c++

palindrome number  logic

A palindrome number is a number such that if we reverse it, it will not change.

 we have used header file on the top of the program then used the namespace after that we have taken input from the console to display

Code

#include<iostream>

#include<conio.h>

using namespace std;




int main()

{

    unsigned long n,num,d,rev=0;

    cout<<"Enter any number: ";

    cin>>n;

    num=n;




    do

    {

        d=n%10;

        rev=(rev*10)+d;

        n=n/10;

    }while(n!=0);

   

    if(num==rev)

        cout<<endl<<"Number is Palindrome";

    else

        cout<<endl<<"Number is not Palindrome";

 getch();

    return 0;

}

palindrome number program in c++

 

I hope you would like this topic about check palindrome number in c++

Post Author: TechieFlair

Leave a Reply

Your email address will not be published.