39页作业(还款年限—月还款额表)

#include<stdio.h>
#include<math.h>
int main()
{
    int m,y;
    double rate,money,loan;
    double s(double rate,double loan,int m);
     printf("输入贷款本金和月利率:");
     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;
}

posted @ 2013-10-20 10:15  执于一念  阅读(157)  评论(0编辑  收藏  举报