Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Palindrome Numbers

 A palindrome number is a number such that if we reverse it, it will not change. For example some palindrome numbers examples are 121, 212, 12321, -454. To check whether a number is palindrome or not first we reverse it and then compare the number obtained with the original, if both are same then number is palindrome otherwise not. 

Source Code:-

#include<iostream.h>
#include<conio.h>
void main()
{  clrscr();
   int n, reverse = 0, temp;
   cout<<"Program to check Palindrome Condition by-Tarun Rawat\n";
   cout<<"\nEnter a number :";
   cin>>n;
   temp=n;
   while( temp != 0 )
     {reverse = reverse * 10;
      reverse = reverse + temp%10;
      temp = temp/10;
     }
   if(n==reverse)
      cout<<"\n"<<n<<" is a palindrome number.\n";
   else
      cout<<"\n"<<n<<" is not a palindrome number.\n";
getch();

}

1 comment:

Blogger Widgets

Find Us On Google, Just type - way2cplusplus -

If you have any questions on implementing or understanding this C++ Program , shoot me a comment and I'll be glad to help! :) :)