Compound Interest

Programming Interview
Questions

← Back

Compound Interest

Write a function compound_interest(P, r, n, t) which calculates the total sum of an investment over a period of time.

Input:

  • P: The principal amount (initial investment)
  • r: The interest rate in decimal form (e.g. 0.05 is 5% investment rate)
  • n: The number of times that interest is compounded per year, and
  • t: The number of years the money is invested for

Output: The total sum of the investment after the compound interest has been accrued.

Your output must be rounded to a whole number.

Not Completed

Completed!

integer_search.py

Tests - to submit your code!

symbol symbol

Efficiency

symbol symbol

Test Case 1

symbol symbol

Test Case 2

symbol symbol

Test Case 3

symbol symbol

Test Case 4

symbol symbol

Test Case 5

symbol symbol

Test Case 6

symbol symbol

Test Case 7

symbol symbol

Test Case 8

symbol symbol

Test Case 9

symbol symbol

Test Case 10

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

symbol Submit to See Results

Join our Newsletter and Recieve the Latest Updates!

Main Links

Compete Trade Courses Assessments Interview Prep Contact Us

Social Media

Facebook Instagram YouTube

Legal

Terms and Conditions

Talent Acquisition

We help firms recruit dedicated, passionate visionaries in mathematics and innovation for leading technology and trading roles. If your company is looking to attract top-tier talent in these fields, we can connect you with individuals who excel in driving technological and mathematical advancements. For more information, contact us here.

© 2024 EverythingQuant. All Rights Reserved.