Rich man's world

Report a typo

In case of a bank's financial crisis, the government guarantees to return a client's deposit if it's less than 700,000 (currency units). The bank offers an annual interest rate of 7.1% on deposits. The interest is compounded annually, meaning it's added to the deposit at the end of each year, and the new interest is calculated based on this increased amount.

Find out how many years it will take for a given initial deposit to exceed the government-protected amount of 700,000.

The input format:

A single integer representing the initial deposit amount. The input value is guaranteed to be between 50,000 and 700,000 (inclusive). Use the input() function to read the initial deposit amount from the user.

The output format:

An integer representing the number of years it takes for the deposit to exceed 700,000.

For example, if the input is 650000:

  • After one year, the deposit would grow to 650000 * 1.071 = 696150.

  • After two years, it would be 696150 * 1.071 = 745576.65, which exceeds 700,000.

Therefore, it takes 2 years for the deposit to exceed the protected amount.

Sample Input 1:

650000

Sample Output 1:

2
Write a program in Python 3





___

Create a free account to access the full topic