%Problem
%Suppose you invest in a mutual fund with fixed return of 8% 
%a year. To simplify the problem, we assume there is no commission fee or 
%any maintenance fee for that. Besides, we invest at the beginning of a year and 
%the capital gain is payed at the end of the year.
%Moreover, all the capital gains will be immediately 
%invested back into this mutual fund at the pay day. 
%Write a function to calculate your capital gain after a certain number of years. 
%This function should accept two input parameters: initial investment and 
%the number of years (you can assume that the number of years is an integer).

%solution
function gain = mutual_fund(init_invest, num_years)
total_capital = init_invest*(1 + 0.08)^num_years;
gain = total_capital - init_invest;
end