Calculate Compound Interest in Java:

public class CompoundInterest {

 public static void main(String[] args) {

 double principal = 15000, rate = 5.5, time = 3;

 double compoundInterest = principal * (Math.pow((1 + rate / 100), time)) – principal;

 System.out.println(“Compound Interest: ” + compoundInterest);

 }

Output:

Compound Interest: 2653.4375

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *