int main() { int N; std::cout << "Enter a number N: "; std::cin >> N;
std::cout << "Three-digit natural numbers with digits summing up to " << N << ":" << std::endl; for (int i = 100; i <= 999; ++i) { int num = i; int sum = 0; while (num != 0) { sum += num % 10; num /= 10; } if (sum == N) { std::cout << i << std::endl; } } return 0;
int main() {
std::cout << "Three-digit natural numbers with digits summing up to " << N << ":" << std::endl;int N;
std::cout << "Enter a number N: ";
std::cin >> N;
for (int i = 100; i <= 999; ++i) {
int num = i;
int sum = 0;
while (num != 0) {
sum += num % 10;
num /= 10;
}
if (sum == N) {
std::cout << i << std::endl;
}
}
return 0;
}