Require only 2 of 3 form fields

I am making a yield calculator. There are 3 fields. Yield Percentage, Purchase Price, and Rent.

For example, I want a 10% yield, and I pay 500k, then my calculator will get the monthly rent to achieve the 10% yield.
Also, If I want a 10% yield, and I input a monthly rent of 500, then my calculator gets the purchase price.
Lastly, If I pay 500k, and let the rent be 500, then my calculator would get the yield percentage.