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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP