7-151 计算存款利息
生活随笔
收集整理的這篇文章主要介紹了
7-151 计算存款利息
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本題目要求計算存款利息,計算公式為interest=money×(1+rate)year?money,其中interest為存款到期時的利息(稅前),money是存款金額,year是存期,rate是年利率。
輸入格式:
輸入在一行中順序給出三個正實數money、year和rate,以空格分隔。
輸出格式:
在一行中按“interest = 利息”的格式輸出,其中利息保留兩位小數。
輸入樣例:
1000 3 0.025輸出樣例:
interest = 76.89代碼長度限制
16 KB
時間限制
400 ms
內存限制
64 MB
#include <stdio.h> #include <math.h> int main(void) //如果不需要從命令行中獲取參數,請用int main(void);否則請用int main(int argc, char *argv[]) {double money,year,rate,interest;scanf("%lf %lf %lf",&money,&year,&rate);interest=money*pow((1+rate),year)-money;printf("interest = %.2f",interest);return 0; }總結
以上是生活随笔為你收集整理的7-151 计算存款利息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 搜索公众号文章
- 下一篇: torch tensor去掉1维_维E、