fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,num,digit,rev=0;
  6. cout<<"enter a positive number :";
  7. cin>>num;
  8. while(num>0)
  9. {
  10. digit=num%10;
  11. rev=(rev*10)+digit;
  12. num=num/10;
  13. }
  14. cout<<"the reverse of number is:"<<rev;
  15. if(n==rev)
  16. cout<<"\n the number is a palindrome";
  17. else
  18. cout<<"\n the number is not a palindrome";
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
enter a positive number :the reverse of number is:56723
 the number is not a palindrome