C语言公式计算利息金额

PHPz
发布: 2023-09-10 18:45:05
转载
1762명이 탐색했습니다.

C语言公式计算利息金额

问题

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

解决方案

计算利息的公式为 −

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

Where r= rate of interest

t=no. of years

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
#include
#include
int main(){
   double P,r,t,A,M;
   printf("amount to be deposit in the bank: ");
   scanf("%lf",&P);
   printf("

enter the rate of interest:"); scanf("%lf",&r); printf("

How many years you want to deposit:"); scanf("%lf",&t); M=((r/100) * t); A=P*exp(M); printf("

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 중국어 웹사이트의 기타 관련 기사를 참조하세요!

来源:tutorialspoint.com
본 웹사이트의 성명
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
더>
最新下载
더>
网站特效
网站源码
网站素材
프론트엔드 템플릿
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!