C++ 中查找复合利息的程序
本教程将介绍一个用于查找复合利息的程序。
复合利息是将当前利息添加到本金中,然后计算更新后的金额的利息。
示例
#include <bits/stdc++.h> using namespace std; int main(){ double principle = 10000, rate = 10.25, time = 5; //calculating compound interest double CI = principle * (pow((1 + rate / 100), time)); cout << "Compound interest is " << CI; return 0; }
输出
Compound interest is 16288.9
广告