Click here for the answer

Each compounding is at half the usual rate, but we compound twice as often per
year:


compoundtwice[P_, r_, n_] := P*(1+R/2)^(2*n)