Click here for the answer
Each compounding is at half the usual rate, but we compound twice as often peryear:
compoundtwice[P_, r_, n_] := P*(1+R/2)^(2*n)