7-151 计算存款利息
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                7-151 计算存款利息
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                本題目要求計(jì)算存款利息,計(jì)算公式為interest=money×(1+rate)year?money,其中interest為存款到期時(shí)的利息(稅前),money是存款金額,year是存期,rate是年利率。
輸入格式:
輸入在一行中順序給出三個(gè)正實(shí)數(shù)money、year和rate,以空格分隔。
輸出格式:
在一行中按“interest = 利息”的格式輸出,其中利息保留兩位小數(shù)。
輸入樣例:
1000 3 0.025輸出樣例:
interest = 76.89代碼長度限制
16 KB
時(shí)間限制
400 ms
內(nèi)存限制
64 MB
#include <stdio.h> #include <math.h> int main(void) //如果不需要從命令行中獲取參數(shù),請用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; }總結(jié)
以上是生活随笔為你收集整理的7-151 计算存款利息的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 搜索公众号文章
- 下一篇: C#数据结构与算法总结
