编写C程序来计算余额分期付款
问题
编写一个C程序来计算每个月后为特定贷款金额(带利息)支付的余额分期付款。
解决方案
以下是给定贷款金额时计算利息的公式-
i=loanamt * ((interest/100)/12);
以下计算给出了利息金额-
i=i+loanamt; firstmon=i-monthlypayment; //第一个月付息 i=firstmon * ((interest/100)/12);
程序
#include输出结果int main(){ float loanamt,interest,monthlypayment; float i,firstmon,secondmon; printf("输入贷款金额:"); scanf("%f",&loanamt); printf("利率:"); scanf("%f",&interest); printf("每月支付:"); scanf("%f",&monthlypayment); //interest calculation// i=loanamt * ((interest/100)/12); //利息金额 i=i+loanamt; firstmon=i-monthlypayment; //第一个月付息 i=firstmon * ((interest/100)/12); i=i+firstmon; secondmon=i-monthlypayment; //第二个月付息 printf("remaining amount need to pay after 1st installment:%.2f\n",firstmon); printf("remaining amount need to pay after 2nd installment:%.2f\n",secondmon); return 0; }
输入贷款金额:45000 利率:7 每月支付:1000 remaining amount need to pay after 1st installment:44262.50 remaining amount need to pay after 2nd installment:43520.70
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下