The program prompts the user for some data, then uses a loop to determine the solution.

It asks for a needed amount, an affordable monthly contribution, and an interest rate; it calculates the time to reach the amount.

Example: if you say you need 120000 and can contribute 1000 monthly and the interest is 3% then the answer is 51 years.

Copy the file, compile, run at the prompt, as before. Most of the code is obvious.