首页 > 后端开发 > C++ > 正文

C语言公式计算利息金额

PHPz
发布: 2023-09-10 18:45:05
转载
3291人浏览过

c语言公式计算利息金额

问题

编写一个C程序,计算存款金额在一些年后的增加利息

解决方案

计算利息的公式为 −

M=((r/100) * t);
A=P*exp(M);
登录后复制

Where r= rate of interest

            t=no. of years

立即学习C语言免费学习笔记(深入)”;

办公小浣熊
办公小浣熊

办公小浣熊是基于商汤大语言模型的原生数据分析产品,

办公小浣熊 77
查看详情 办公小浣熊

            P=amount to be deposited

            M=temporary variable

            A= Final amount after interest

算法

START
Step 1: declare double variables
Step 2: read amount to be deposited
Step 3: read rate of interest
Step 4: read years you want to deposit
Step 5: Calculate final amount with interest
         I. M=((r/100) * t);
         II. A=P*exp(M);
Step 6: Print final amount
STOP
登录后复制

示例

#include<stdio.h>
#include<math.h>
#include<ctype.h>
int main(){
   double P,r,t,A,M;
   printf("amount to be deposit in the bank: ");
   scanf("%lf",&P);
   printf("</p><p> enter the rate of interest:");
   scanf("%lf",&r);
   printf("</p><p> How many years you want to deposit:");
   scanf("%lf",&t);
   M=((r/100) * t);
   A=P*exp(M);
   printf("</p><p> amount after %0.1lf years with interest is:%0.2lf",t,A);
   return 0;
}
登录后复制

输出

amount to be deposit in the bank: 50000
enter the rate of interest:6.5
How many years you want to deposit:5
amount after 5.0 years with interest is:69201.53
登录后复制

以上就是C语言公式计算利息金额的详细内容,更多请关注php中文网其它相关文章!

相关标签:
360借条
360借条

3分钟审核,最快5分钟放款,极速到账,低服务费,年化综合息费率7.2%起。

下载
来源:tutorialspoint网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号