File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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.
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments