fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int re(int a)
  6. {
  7. int b,c,d,e;
  8. b = a % 10;
  9. c = (a - b)/10%10;
  10. d = (a - b - c*10)/100 % 10;
  11. e = (a / 1000);
  12. return b * 1000 + c * 100 + d * 10 + e;
  13. }
  14.  
  15. int main ()
  16. {
  17. int a;
  18. cout << "Input number: ";
  19. cin >> a;
  20. cout << re(a);
  21.  
  22.  
  23. }
  24.  
Success #stdin #stdout 0s 4448KB
stdin
Standard input is empty
stdout
Input number: 7702