用於計算簡單利息的 C 語言程式?


簡單利息是本金、利率和時長的乘積(單位:年)乘以 100。

例如,

輸入 − p=5、r=4、t=5

輸出 − 1

說明:簡單利息 = (本金 * 利率 * 年數) / 100

SI= 5*4*5/100 = 1

示例

#include<iostream>
#include <stdio.h>
using namespace std;
int main() {
   //principle amount
   float p = 5;
   //time
   float r = 4;
   //rate in years
   float t = 5;
   // Simple interest
   float SI = 0;
   SI =(p * t * r) / 100;
   printf("Simple Interest = %f ",SI);
   return 0;
}

輸出

Simple Interest = 1.0000

更新於: 2019 年 8 月 9 日

590 次瀏覽

開啟你的職業生涯之路

透過完成課程獲得認證

開始學習
廣告