Best way to solve these kind of problem is to go bottom up. Just check what happens in base condition, then 1 level up.
Example:
f(0) = 1 (base condition)
f(1) = (i=1 to 1, sum = 0 + f(0)) = 1
f(2) = (i=1 to 2, sum = 0 + f(0) + f(1)) = 0+1+2 = 2
f(3) = (i=1 to 3, sum = 0 + f(0) + f(1) + f(2)) = 0 + 1 + 1 + 2 = 4
f(4) = (i=1 to 4, sum = 0 + f(0) + f(1) + f(2) + f(3)) = 0 + 1 + 1 + 2 + 4 = 8
and so on...