C++:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
typedef unsigned int my_counter;
typedef unsigned int my_sum;
const my_counter my_min_digit = 100;
const my_counter my_max_digit = 1000;
int main() {
my_counter dd;
std::cout << "Please enter your digit=";
cin.clear();
cin >> dd;
cout << endl << "Your digit is=" << dd;
cout << endl;
my_counter i;
my_counter i1;
for (i = my_min_digit, i1 = 0; i != my_max_digit; ++i) {
string str;
stringstream sstr;
sstr << i;
sstr >> str;
my_sum sum = 0;
my_counter j;
for (j = 0;; ++j) {
if (str[j] == 0) break;
my_sum val;
switch (str[j]) {
case '0':val = 0; break;
case '1':val = 1; break;
case '2':val = 2; break;
case '3':val = 3; break;
case '4':val = 4; break;
case '5':val = 5; break;
case '6':val = 6; break;
case '7':val = 7; break;
case '8':val = 8; break;
case '9':val = 9; break;
default: cout << endl << "Galaxy error"; return 1;
}
sum += val;
}
if (sum == dd) {
cout << endl << "digit(" << i1 << ")=" << i;
++i1;
}
}
cout << endl;
if (i1 == 0) {
cout << endl << "digits don't find";
}
else {
cout << endl << "found " << i1 << " digits";
}
return 0;
}