Skip to content
Related Articles

Related Articles

Improve Article

C Program for compound interest

  • Last Updated : 07 Feb, 2018

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

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;
}

Please refer complete article on Program to find compound interest for more details!

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.

My Personal Notes arrow_drop_up
Recommended Articles
Page :