C言語による利息計算式

PHPz
リリース: 2023-09-10 18:45:05
転載
1837 人が閲覧しました

C言語による利息計算式

#問題

数年後の預金額の増加利息を計算する C プログラムを作成してください

解決策

利息の計算式は、−

M=((r/100) * t);
A=P*exp(M);
ログイン後にコピー

です。ここで、r= 利率

t= 年数

P= 入金する金額

M=一時変数

A= 利息後の最終金額

アルゴリズム

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 中国語 Web サイトの他の関連記事を参照してください。

ソース:tutorialspoint.com
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!