當前位置:外匯行情大全網 - 貸款諮詢 - 有關銀行貸款還貸的c語言程序

有關銀行貸款還貸的c語言程序

妳的錯誤實在太多了。看代碼王的程序簡潔易懂

#include<stdio.h>

#include<math.h>

int main()

{

double z,k,x,monthPay,allMoney,temp=0;

int n,i;

printf("輸入借款總額、貸款年限、年利率: ");

//貸款總和最好不要用int型的,int的最大值是32767,那妳豈不是超了

scanf("%lf%d%lf",&z,&n,&k);

//計算n年後要還的總的錢數 pow(x,y)是在頭文件math.h中的函數計算x^y

allMoney = z*pow((1+k/12),12*n);

//式子∑x(1+k/12)^i (i=0,1,2,..,n*12-1)將x提出到前面計算 temp=∑(1+k/12)^i

for(i=0; i<12*n; i++)

temp += pow((1+k/12),i);

//根據等式z(1+k/12)^(12*n) = ∑x(1+k/12)^i (i=0,1,2,..,n*12-1) 得x=allMoney/temp;

x = allMoney/temp;

printf("每月應還款:%lf", x);

}

  • 上一篇:郵政房貸24萬,19還清。等額本息的月供是多少?
  • 下一篇:特斯拉貸款政策
  • copyright 2024外匯行情大全網