fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string re(int x);
  6.  
  7. int main(){
  8. int a;
  9. cin >> a ;
  10. cout << re(a) << endl;
  11. }
  12.  
  13. string re(int x){
  14. int rev=0;
  15. int temp;
  16. if (x<0){
  17. return "false";
  18. }
  19. while(x!=0){
  20. temp = x % 10;
  21. x /= 10;
  22. rev = rev * 10 + temp;
  23. }
  24. cout << rev << endl;
  25. if(x == rev){
  26. return "true";
  27. }
  28. else
  29. return "false";
  30.  
  31. }
  32.  
  33.  
Success #stdin #stdout 0s 15240KB
stdin
121
stdout
121
false