Build a simple mortgage calculator widget that takes a loan amount, interest rate, and loan term, then calculates the monthly mortgage payment, total payment amount, and total interest paid.
The last two requirements might not be given to you during interviews; you're expected to clarify.
The formula for calculating the monthly payment is:
M = P(i(1+i)n)/((1+i)n - 1)
Here's an example of Google's mortgage calculator (you might need to be in the US for it to appear):

This question is adapted from FrontendEval's Mortgage Calculator.
The official solutions validate positive, finite values for the loan amount, interest rate, and term. A calculation that produces a non-finite payment also shows an error.