#include <iostream> #include <math.h> using namespace std; int main() { int temp = 0, k = 0, weigh = 0; for (int i = 1000; i <= 9999; i++) { k = i; temp = 0; for (int j = 4; j >= 1; j--) { weigh = k % 10; k = k / 10; temp += pow(10, j - 1) * weigh; } if (i * 9 == temp) { cout << i << endl; } } return 0; }