Calculate the simple interest given principal amount, annual interest rate (as a percentage), and time period in years. Return the interest amount rounded to 2 decimal places.
Formula: Simple Interest = (Principal × Rate × Time) / 100
Examples:
Input: principal = 1000, rate = 5, years = 2
Output: 100.00
Explanation: (1000 × 5 × 2) / 100 = 100.00
Input: principal = 5000, rate = 8.5, years = 3
Output: 1275.00
Explanation: (5000 × 8.5 × 3) / 100 = 1275.00
Input: principal = 0, rate = 10, years = 5
Output: 0.00
Explanation: Principal is 0, so interest is 0
Apex Code Editor
Welcome to Lightning Challenge!
Create an Account
Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.
Create accountHow It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Note
You can test your code by connecting to Salesforce, but to save your progress and earn points, you'll need to create an account. Your solutions and achievements will be tracked automatically once you're logged in.