#include #include using namespace std; plus addition; multiplies multiplication; int accumule_chiffres(int n, function operation, int neutre = 0) { if (n <= neutre) return neutre; return operation(n % 10, accumule_chiffres(n / 10, operation, neutre)); } int main() { for (int candidat(10), nb_ok(0); nb_ok < 20; ++candidat) { if ( accumule_chiffres(candidat, addition ) == accumule_chiffres(candidat, multiplication, 1)) { ++nb_ok; cout << candidat << endl; } } return 0; }