第二章例2-5

/* 计算存款本息 */

#include<stdio.h>

#include <math.h>

int main(void)

{

    int money,year;

    double rate,sum;

    printf("Enter money:");
    
    scanf_s("%d",&money);

    printf("Enter year:");

    scanf_s("%d",&year);

    printf("Enter rate:");

    scanf_s("%lf",&rate);

    sum=money*pow(1+rate,year);

    printf("sum=%.2f\n",sum);


    return 0;

}

posted @ 2013-09-30 19:15  刘睿1994  阅读(100)  评论(0编辑  收藏  举报