I can't think of any (sensible) way to use recursion here..
Can you do the C(k) = n!/(k!*(n-k)!) part?
If you can,
print '= '
for k = 0 to n
print C(k), '(a^', n-k, '*b^', k, ') + ' //think of a way to deal with the last '+'
print '= '
for k = 0 to n
print C(k), '(', pow(a, n-k)*pow(b, k), ') + '
print '= ', pow(a+b, n)
http://en.wikipedia.org/wiki/Pascal's_triangle
in Pascal's triangle, n'th row consists of all the coefficients of (a+b)n (n starts from 0)
if you only allow n from 1 to 9, you could hard code it. if you want it to be more dynamic, you could use recursion, but I assume then factorials would be faster.