This is a very simple program we need to be panic for this.A number is said to be palindrome if reversal of the number is equal to itself.For ex:141 is a palindrome number.To find the reverse of the number we need to get each digit of the given number.For this we shall use the number 10.By dividing the number by 10 we get the last digit as remainder and remaining digits as quotients.Now we shall write the code.
#include #include class palindrome { public: int n,r,rev,temp; void check(); }; void palindrome :: check() { rev=0,temp=n; while(temp>0) { r=temp%10; temp=temp/10; rev=rev*10+r; } if(rev == n) { cout<<"Given number "<<n<<" is palindrome"; } else cout<<"Given number "<<n<<" is not palindrome"; } void main() { clrscr(); palindrome ob; coutob.n; ob.check(); getch(); }
Output:
You can download the code:download
Tech Tip : Now work on your software projects remotely from anywhere on any device(PC/Mac/android/iOS) by loading your software development environment into the cloud with high performance hosted citrix vdi from CloudDesktopOnline. If you prefer a dedicated server, try out dedicated gpu hosting from Apps4Rent with 24*7 impeccable tech-support.