**What is ‘Compound interest’?**

**Compound interest** is the addition of interest to the principal sum of a loan or deposit, or in other words, interest on interest. It is the result of reinvesting interest, rather than paying it out, so that interest in the next period is then earned on the principal sum plus previously-accumulated interest. Compound interest is standard in finance and economics.

Compound interest may be contrasted with simple interest, where interest is not added to the principal, so there is no compounding.

**Compound Interest formula:**

Formula to calculate compound interest annually is given by:

Compound Interest = P(1 + R/100)^{r}

Where,

P is principle amount

R is the rate and

T is the time span

**Pseudo Code:**

Input principle amount. Store it in some variable say principle. Input time in some variable say time. Input rate in some variable say rate. Calculate compound interest using formula, Compound Interest = principle * (1 + rate / 100)^{ time}). Finally, print the resultant value of CI.

**Example:**

Input : Principle (amount): 1200 Time: 2 Rate: 5.4 Output : Compound Interest = 1333.099243

## C++

`// CPP program to find compound interest for ` `// given values. ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `int` `main() ` `{ ` ` ` `double` `principle = 10000, rate = 10.25, ` `time` `= 5; ` ` ` ` ` `/* Calculate compound interest */` ` ` `double` `CI = principle * (` `pow` `((1 + rate / 100), ` `time` `)); ` ` ` ` ` `cout << ` `"Compound interest is "` `<< CI; ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find compound interest for ` `// given values. ` `import` `java.io.*; ` ` ` `class` `GFG ` `{ ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` `double` `principle = ` `10000` `, rate = ` `10.25` `, time = ` `5` `; ` ` ` ` ` `/* Calculate compound interest */` ` ` `double` `CI = principle * ` ` ` `(Math.pow((` `1` `+ rate / ` `100` `), time)); ` ` ` ` ` `System.out.println(` `"Compound Interest is "` `+ CI); ` ` ` `} ` `} ` `// This code is contributed by Anant Agarwal. ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 program to find compound ` `# interest for given values. ` ` ` `def` `compound_interest(principle, rate, time): ` ` ` ` ` `# Calculates compound interest ` ` ` `CI ` `=` `principle ` `*` `(` `pow` `((` `1` `+` `rate ` `/` `100` `), time)) ` ` ` `print` `(` `"Compound interest is"` `, CI) ` ` ` `# Driver Code ` `compound_interest(` `10000` `, ` `10.25` `, ` `5` `) ` ` ` `# This code is contributed by Abhishek Agrawal. ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find compound ` `// interest for given values ` `using` `System; ` ` ` `class` `GFG { ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `Main() ` ` ` `{ ` ` ` `double` `principle = 10000, rate = 10.25, time = 5; ` ` ` ` ` `// Calculate compound interest ` ` ` `double` `CI = principle * (Math.Pow((1 + ` ` ` `rate / 100), time)); ` ` ` ` ` `Console.Write(` `"Compound Interest is "` `+ CI); ` ` ` `} ` `} ` ` ` `// This code is contributed by Nitin Mittal. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find ` `// compound interest for ` `// given values. ` ` ` `$principle` `= 10000; ` `$rate` `= 10.25; ` `$time` `= 5; ` ` ` `// Calculate compound interest ` `$CI` `= ` `$principle` `* (pow((1 + ` ` ` `$rate` `/ 100), ` `$time` `)); ` ` ` `echo` `(` `"Compound interest is "` `. ` `$CI` `); ` ` ` `// This code is contributed by Ajit. ` `?> ` |

*chevron_right*

*filter_none*

Output:

Compound interest is 16288.9

This article is contributed by **Anurag Rawat**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Program to find the rate percentage from compound interest of consecutive years
- Compound Interest
- Program to find simple interest
- Simple Interest
- Times required by Simple interest for the Principal to become Y times itself
- Program to find parity
- Program to find amount of water in a given glass
- Program to find last digit of n'th Fibonnaci Number
- C++ program to find all numbers less than n, which are palindromic in base 10 and base 2.
- Program to find Normal and Trace of a matrix
- C program to find Decagonal Number
- Program to find Cullen Number
- Program to find Star number
- Puzzle | Program to find number of squares in a chessboard
- Program to find sum of elements in a given array
- Program to find largest element in an array
- Program to find GCD or HCF of two numbers
- Program to find LCM of two numbers
- Program to find transpose of a matrix
- Program to find area of a triangle