C++ Program to Check whether the Number is Palindrome Number or Not

 C++ Program to Check whether the Number is Palindrome Number or Not


This program reverses an integer (entered by the user) using while loop. Then, if statement is used to check whether the reversed number is equal to the original number or not.

This program takes an integer from user and that integer is reversed.

If the reversed integer is equal to the integer entered by user then, that number is a palindrome if not that number is not a palindrome.

Practice Question :

1.Wap to check the number is prime or not 

2.Wap to check the character is vowel, consonants or special character. 

3.Wap to find the sum of n natural numbers.

4.Wap to print all prime number in given range taking range from users.

5.Wap to print the multiplicaton table .

Source code :

#include<iostream>
using namespace std;

int main(){
     int rem,sum=0,num;
     cin>>num;
     int original=num;
     while(num!=0){
         rem=num%10;
         sum=sum*10+rem;
         num=num/10;
     }
     if(sum==original)
     cout<<"The number you entered is palindrome number"<<endl;
     else
     cout<<"The number you entered is not palindrome number"<<endl;

    return 0;
}
Previous
Next Post »