kotlin 计算平方_Kotlin程序来计算复利
生活随笔
收集整理的這篇文章主要介紹了
kotlin 计算平方_Kotlin程序来计算复利
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
kotlin 計算平方
Compound interest is the sum of principal amount and interest of interest.
復利是本金和利息之和。
Given, principal, rate, and time, we have to calculate the Compound interest.
給定本金,利率和時間,我們必須計算復利。
Formula to calculate Compound interest is: P * (Math.pow(( 1 + R/100), T)
計算復利的公式為:P *(Math.pow((1 + R / 100),T)
Where,
哪里,
P is Principal amount.
P是本金。
R is rate of interest per annum.
R是每年的利率。
T is time in years.
T是以年為單位的時間。
Example:
例:
Input:P = 5000R = 12T = 5Output:Compound Interest = 8811.708416000003計算Kotlin復利的程序 (Program to calculate Compound interest in Kotlin)
package com.includehelpimport java.util.*//Main Function , Entry point of Program fun main(args: Array<String>) {//Input Streamval scanner = Scanner(System.`in`)//Input Amountprint("Enter Principal Amount : ")val principalAmount = scanner.nextDouble()//Input Interest Rateprint("Enter Rate of Interest : ")val rateOfInterest = scanner.nextDouble()//Input time in yearsprint("Enter Time : ")val time = scanner.nextDouble()//Calculate Compound Interestval compoundInterest = principalAmount.toDouble() * Math.pow((1 + rateOfInterest.toDouble()/100.00),time.toDouble())//Print Compound Interestprintln("Compound Interest is :$compoundInterest") }Output
輸出量
Enter Principal Amount : 5000 Enter Rate of Interest : 12 Enter Time : 5 Compound Interest is :8811.708416000003翻譯自: https://www.includehelp.com/kotlin/calculate-compound-interest.aspx
kotlin 計算平方
總結
以上是生活随笔為你收集整理的kotlin 计算平方_Kotlin程序来计算复利的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: DNF女大枪那套内衣时装怎么买?隐藏了背
- 下一篇: 救护车多少钱一辆啊?