A very simple, but recursive, solution would be
private bool isDiv(int n) {
if (n < 6) {
return false;
} else if (n == 6 || n == 9 || n == 20) {
Console.Write(n);
return true;
} else if (isDiv(n - 6)) {
Console.Write(" + " + 6);
return true;
} else if (isDiv(n - 9)) {
Console.Write(" + " + 9);
return true;
} else if (isDiv(n - 20)) {
Console.Write(" + " + 20);
return true;
}
return false;
}
But keep in mind that this is not the fastest solution - but it works good for small numbers like the ones in your example
Oh and 21 is quite possible:
2*6 + 9 = 21