计算简单利息的Java程序

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

null

单利公式如下所示:

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

哪里

  • P是本金
  • 这是时间和时间
  • 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.


输出

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

请参阅网站上的完整文章 寻找简单兴趣的程序 更多细节!

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享