Skip to content

Commit b855e2f

Browse files
committed
added a ne Java program
1 parent dd67abd commit b855e2f

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Java/Program-11/Program.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Java program to find compound interest for
2+
// given values.
3+
import java.io.*;
4+
5+
class GFG
6+
{
7+
public static void main(String args[])
8+
{
9+
double principle = 10000, rate = 10.25, time = 5;
10+
11+
/* Calculate compound interest */
12+
double CI = principle *
13+
(Math.pow((1 + rate / 100), time));
14+
15+
System.out.println("Compound Interest is "+ CI);
16+
}
17+
}
18+
// This code is contributed by Anant Agarwal.

Java/Program-11/Readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Q. Java Program for compound interest
2+
3+
4+
Formula to calculate compound interest annually is given by:
5+
6+
Compound Interest = P(1 + R/100)r
7+
Where,
8+
P is principle amount
9+
R is the rate and
10+
T is the time span
11+
12+
13+
Input : Principle (amount): 1200
14+
Time: 2
15+
Rate: 5.4
16+
Output : Compound Interest = 1333.099243

0 commit comments

Comments
 (0)