C++ Program to Check Palindrome Number




In this example we will learn how to Check if the particular number is Palindrome or not.

C++ – PALINDROMIC NUMBERS Example

#include<stdio.h>
#include <iostream>
using namespace std;

int main(){
  int num,r,sum=0,temp;

  cout << "Enter a number: ";
  cin >> num;

  for(temp=num;num!=0;num=num/10){
    r=num%10;
    sum=sum*10+r;
  }
  if(temp==sum)
    cout << temp << " is a palindrome";
  else
    cout << temp << " is not a palindrome";

  return 0;
}

/*
OUTPUT
Enter a number: 25
25 is not a palindrome
*/

Online computer science courses to jumpstart your future.
After you write a C++ program you compile it; that is, you run a program called compiler that checks whether the program follows the C++ syntax

  • if it finds errors, it lists them
  • If there are no errors, it translates the C++ program into a program in machine language which you can execute

Different ways of Asking the above question

  • C++ program to find palindrome of a number
  • C++ program to find armstrong number
  • Display first 100 palindromic prime numb‎
  • palindromic numbers – C++ Forum
  • All palindrome numbers from 1 to 100,000 in C++
  • C++ Program to Check Palindrome Number
  • find nth palindrome number‎
  • C++ project euler
  • Finding a palindrome number‎

 

 

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*