Back to Practice
#0191
Compound Interest for Two Years
MediumAptitude25 min20 XP
Problem
Find the compound interest on 10000 at 10% per annum for 2 years, compounded annually.
Why This Matters
Compound-interest questions test whether you update the base after each period.
Examples
Example 1
InputP = 10000, r = 10%, t = 2
Output2100
Amount = 10000 * 1.1 * 1.1 = 12100, so interest = 2100.
Constraints
- Return the exact requested result.
- Handle common edge cases.
- Keep the solution readable before optimizing.
CodeReasoning
Find the compound interest on 10000 at 10% per annum for 2 years, compounded annually.
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
InputP = 10000, r = 10%, t = 2
Expected2100
Amount = 10000 * 1.1 * 1.1 = 12100, so interest = 2100.
Hidden Test Categories
minimal inputrepeated valueslarger realistic input