Created
November 13, 2023 22:15
-
-
Save whizyrel/e4b342941fbbed245942514c0035f979 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.evryword.simpleinterest; | |
| public class SimpleInterest { | |
| public static void main(String[] args) { | |
| final double totalInterest = calculateSimpleInterest(); | |
| System.out.format("[totalInterest] %f", totalInterest); | |
| } | |
| public static double calculateSimpleInterest() { | |
| final int n = 10; | |
| double a = 0; | |
| final int p = 1000; | |
| final double r = 5 / 100; | |
| for (int i = 0; i < n; i++) { | |
| a = a + (p * (1 + r) * (i + 1)); | |
| } | |
| return a; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment