编写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 婚前女儿生日祝福语简短