C++ Program to Find Compound Interest
Here you will know Compound Interest Formula and get the example code of C++ Program to Find Compound Interest. To calculate the compound interest, formula is given below.
How to Calculate Compound Interest C++
Example of C++ Program to Find Compound Interest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> using namespace std; int main() { float p, n, r; cout << "Enter the Principal amount : "; cin >> p; cout << "Enter the Rate of Interest : "; cin >> r; cout << "Enter the Number of Years : "; cin >> n; float CI = p * (pow((1 + r / 100), n))-p; cout << "Compound Interest = " << CI; return 0; } |
Output
Enter the Principal amount : 2000
Enter the Rate of Interest : 5
Enter the Number of Years : 5
Compound Interest = 552.56
Check out our other C++ programming Examples