How do you do this kind of plroblem?

What is the total balance due on a $20000 loan at 5% for 6years if it is compounded semi-annually?
(2x per year)

Pt = Po(1 + r)n.

r = 5%/yr * 0.5yr = 2.5% = 0.025 = semi-annual rate expressed as a decimal.

n=2 comp/yr * 6yrs = 12 comp. periods.

Pt = 20000(1.025)^12,
Pt = 20000 * 1.3449 = $26,897.78