1#include <iostream>
2#include <string>
3
4using namespace std;
5
6int reverse(int number); // reverses the number's digits
7
8int main() {
9
10 int x = 18475;
11
12 cout << "18475 reversed is " << reverse(18475) << endl;
13}
14
15int reverse(int number) {
16
17 int result = 0;
18
19 while (number > 0) {
20 result = result * 10 + number % 10;
21 number /= 10;
22 }
23
24 return result;
25
26}