编写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
热门推荐
10 男朋友祝福语简短新年
11 牛年女神节祝福语简短
12 许愿星姐妹祝福语简短
13 订婚新发言简短祝福语
14 新年祝福语长篇文案简短
15 父亲祝福语大全简短语
16 怀念青春祝福语简短
17 信耶稣的人祝福语简短
18 三十三句祝福语简短