📜  计算单利的Java程序

📅  最后修改于: 2022-05-13 01:55:38.602000             🧑  作者: Mango

计算单利的Java程序

单利是一种快速计算贷款利息的方法。单利是通过将每日利率乘以本金乘以两次付款之间的天数来确定的。

单利公式由下式给出:

Simple Interest = (P x T x R)/100 

在哪里,

  • P是本金
  • T 是时间和
  • R 是比率

例子: -

Example 1:

Input :  P = 10000
         R = 5
         T = 5
Output : 2500

Explanation - We need to find simple interest on 
Rs. 10, 000 at the rate of 5% for 5 
units of time.

Example 2:

Input :  P = 3000
         R = 7
         T = 1
Output : 210

示例 1:

Java
// Java program to compute
// simple interest for given principal
// amount, time and rate of interest.
import java.io.*;
  
class GFG {
    public static void main(String args[])
    {
        // We can change values here for
        // different inputs
        float P = 1, R = 1, T = 1;
  
        /* Calculate simple interest */
        float SI = (P * T * R) / 100;
        System.out.println("Simple interest = " + SI);
    }
}
  
// This code is contributed by Anant Agarwal.


Java
// Java program to compute
// simple interest for given principal
// amount, time and rate of interest.
import java.io.*;
  
class GFG {
    public static void main(String args[])
    {
        // We can change values here for
        // different inputs
        float P = 10000, R = 5, T = 5;
  
        // Calculate simple interest
        float SI = (P * T * R) / 100;
        System.out.println("Simple interest = " + SI);
    }
}


输出
Simple interest = 0.01

示例 2:

Java

// Java program to compute
// simple interest for given principal
// amount, time and rate of interest.
import java.io.*;
  
class GFG {
    public static void main(String args[])
    {
        // We can change values here for
        // different inputs
        float P = 10000, R = 5, T = 5;
  
        // Calculate simple interest
        float SI = (P * T * R) / 100;
        System.out.println("Simple interest = " + SI);
    }
}
输出
Simple interest = 2500.0

请参阅有关该程序的完整文章以找到简单的兴趣以获取更多详细信息!