For a repayment mortgage, the calculation spreads capital and interest across equal monthly payments. The annual percentage rate you enter is divided by 100 and then by 12 to obtain the monthly rate. The term in years is multiplied by 12 to obtain the number of payments.
The formula is payment = P × r × (1 + r)ⁿ ÷ ((1 + r)ⁿ − 1), where P is the mortgage amount, r the monthly rate and n the number of monthly payments. At 0% interest, payment is simply P ÷ n.
For interest-only, monthly payment = P × r. No capital is repaid through those monthly payments, so the original balance remains due at the end.