整存整付细算每月 年本利和
请先参考这篇修正过的
https://www.ptt.cc/bbs/Bank_Service/M.1698566305.A.A4E.html
本程式使用他行 1.645% 固定利率
//copy paste to https://www.onlinegdb.com/online_c++_compiler and press run
#include <iostream>
#include <stdio.h>
#include <math.h>
int main()
{
double accumulation; //每月利息
double principal_interest = 10000.0; //本利和初始值 1 万
//连算3年
for (int i = 0; i<3; i++)
{
//每日利息并取小数点第五位
//round(principal_interest * 1.645 / 100 / 365 * 100000.0) / 100000.0
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation; //当月分的本利和
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 28;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 30;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 30;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 30;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 30;
principal_interest += accumulation;
accumulation = round(principal_interest * 1.645 / 100 / 365 * 100000.0)
/ 100000.0 * 31;
principal_interest += accumulation;
//显示当年结果
printf("principal_interest: %f\n", principal_interest);
}
getchar(); //等待enter键结束
return true; //返回成功码 1
}
//第1年 10165.745630
//第2年 10334.238280
//第3年 10505.524190
各自细算自己的利息吧
※ 引述《fatalfeel2 (风在动)》之铭言:
: 请先参考这篇
: https://www.fubon.com/banking/document/news/TW/deposit_interest.pdf
: 每日利息之计算方式如下:1,000,000 元*0.8%*1/365 =21.9178081
: 元,四舍五入至小数点第五位后每日利息相当于 21.91781 元。假设计息期间首月 31 日
: 、次月 28 日,则该 2 个月之利息分别为:
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 101.138.46.112 (台湾)
※ 文章网址: https://www.ptt.cc/bbs/PublicServan/M.1698555790.A.7DD.html