實驗2-2-3 計算存款利息 (10分)


本題目要求計算存款利息,計算公式為1,其中interest為存款到期時的利息(稅前),money是存款金額,year是存期,rate是年利率。

輸入格式:

輸入在一行中順序給出三個正實數money、year和rate,以空格分隔。

輸出格式:

在一行中按“interest = 利息”的格式輸出,其中利息保留兩位小數。

輸入樣例:

1000 3 0.025
 

輸出樣例:

interest = 76.89


#include<stdio.h>
#include<math.h>
int main()
{
    double money,year,rate,interest;
    scanf("%lf%lf%lf",&money,&year,&rate);
    interest=money*( pow((1+rate),year ))-money;
    printf("interest = %.2lf",interest);
    return 0;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM