A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/java/java-program-for-compound-interest/ below:

Java Program for compound interest

Java Program for compound interest

Last Updated : 23 Jul, 2025

Try it on GfG Practice

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

[tabby title="Java"]

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!



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4