Investment Calculator

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

An investment with an initial value of x is compounded annually at a rate of y. Using a loop, calculate the number of years needed until the investment is worth z.


The first line of input contains x with at most 2 decimal places.
The second line of input contains z, with at most 2 decimal places.
The third line of input contains y, the rate of interest in percent with at most 2 decimal places. The interest will not be 0 or greater than 100%.


Output the number of years needed before the interest with initial value x reaches a value of z with a compound interest of y every year.

Sample Input


Sample Output



  • 2
    selena_zhang  commented on Nov. 19, 2019, 7:53 p.m.

    Isn't y future value and z interest?

  • -4
    Samuel_Liu  commented on Nov. 19, 2019, 2:20 p.m.

    I feel like this question is a bit confusing

    • 6
      sankeeth_ganeswaran  commented on Nov. 19, 2019, 2:26 p.m.


      • -100000
        Samuel_Liu  commented on Nov. 19, 2019, 8:05 p.m. edited

        This comment is hidden due to too much negative feedback. Click here to view it.

        • 10000000
          EgorGor  commented on Dec. 6, 2019, 9:01 a.m. edit 2


          - Sankeeth Gahtrrsdhewhan

          • -2
            Serog1sPerog1s  commented on Dec. 7, 2019, 9:58 p.m.

            disgustang thoust slave of fashion

            • 1
              Eric_Zhang  commented on Dec. 12, 2019, 2:09 p.m.