习题2-6
![](http://images0.cnblogs.com/blog/570517/201310/30215103-5a31a2a0c94c4a00a809eb20d6e7b71e.png)
#include<stdio.h> #include<math.h> int main() { int m,y; double rate,money,loan; double s(double rate,double loan,int m); printf("Enter loan,rate:"); scanf("%lf%lf",&loan,&rate); for(y=5;y<=30;y++){ m=12*y; money=s(rate,loan,m); printf("年分%d 月还款额%.1f\n",y,money); } return 0; } double s(double rate,double loan,int m) { double money; money=loan*(rate*pow(1+rate,m))/(pow(1+rate,m)-1); return money; }