fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int diff_with_reveresed_number(int input1){
  5. int temp=input1;
  6. int rev=0;
  7. while(temp!=0){
  8. int r=temp%10;
  9. rev = rev*10 + r;
  10. temp /= 10;
  11. }
  12. return abs(rev-input1);
  13. }
  14. int main() {
  15. // your code goes here
  16. cout<<diff_with_reveresed_number(245);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5680KB
stdin
Standard input is empty
stdout
297