39页第6题 求贷款的金额
/*计算客户购房办理贷款*/ #include <stdio.h> #include <math.h> /*调用函数*/ int main(void) { int year; double loan,money,my,rate; printf("Enter loan:"); /*输入提示*/ scanf("%lf",&loan); printf("Enter rate:");/*输入提示*/ scanf("%lf",&rate); printf("year money\n"); for(year=5;year<=30;year++){ my=pow(1+rate,12*year); /*计算指数函数的公式*/ money=loan*rate*my/(my-1); printf("year=%d money=%.0f\n",year,money); } return 0; }