Java Program for compound interest Last Updated : 31 Mar, 2023 Improve Improve Like Article Like Save Share Report Compound Interest formula: Formula to calculate compound interest annually is given by: Compound Interest = P(1 + R/100)t Where, P is principal amount R is the rate and T is the time span Example: Input : Principal (amount): 1200 Time: 2 Rate: 5.4 Output : Compound Interest = 1333.099243 Java // Java program to find compound interest for // given values. import java.io.*; class GFG { public static void main(String args[]) { double principal = 10000, rate = 10.25, time = 5; /* Calculate compound interest */ double CI = principal * (Math.pow((1 + rate / 100), time)); System.out.println("Compound Interest is "+ CI); } } // This code is contributed by Anant Agarwal. Please refer complete article on Program to find compound interest for more details! Like Article Suggest improvement Previous Java Program to Calculate Simple Interest Next Java Program to Find the Perimeter of a Rectangle Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads Java Program to Calculate Interest For FDs, RDs using Inheritance Java Program to Calculate Simple Interest Java Program for Program to calculate volume of a Tetrahedron Java Program for Program to find area of a circle Java Program for Program to cyclically rotate an array by one Java Program to Extract Content from a Java's .class File Java Program to Implement Control Table in Java Java Program to Empty an ArrayList in Java How to Convert java.sql.Date to java.util.Date in Java? Different Ways to Convert java.util.Date to java.time.LocalDate in Java Like GeeksforGeeks Article Tags : Java Programs