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 = 5000
R = 12
T = 5
Output:
Compound Interest = 8811.708416000003

计算Kotlin复利的程序 (Program to calculate Compound interest in Kotlin)

package com.includehelp
import java.util.*
//Main Function , Entry point of Program
fun main(args: Array<String>) {
//Input Stream
val scanner = Scanner(System.`in`)
//Input Amount
print("Enter Principal Amount : ")
val principalAmount = scanner.nextDouble()
//Input Interest Rate
print("Enter Rate of Interest : ")
val rateOfInterest = scanner.nextDouble()
//Input time in years
print("Enter Time : ")
val time = scanner.nextDouble()
//Calculate Compound Interest
val compoundInterest = principalAmount.toDouble() * Math.pow((1 + rateOfInterest.toDouble()/100.00),time.toDouble())
//Print Compound Interest
println("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程序来计算复利相关推荐

  1. kotlin 计算平方_Kotlin程序计算自然数之和

    kotlin 计算平方 Given a number number, and we have to calculate the sum of all natural numbers from 1 to ...

  2. kotlin创建静态单利_Kotlin程序来计算单利

    kotlin创建静态单利 Given, principal, rate, and time, we have to calculate the simple interest. 给定本金,利率和时间, ...

  3. kotlin 判断数字_Kotlin程序可以逆转数字

    kotlin 判断数字 Given an integer number, we have to find reverse number and print it. 给定一个整数,我们必须找到反向数字并 ...

  4. kotlin 尾递归阶乘_Kotlin程序查找数字的阶乘

    kotlin 尾递归阶乘 Factorial of number is the product of all positive numbers less or equal to the number. ...

  5. kotlin 覆盖属性_Kotlin程序| 方法覆盖的示例

    kotlin 覆盖属性 方法重载 (Method Overriding) Method overriding allows derived class has the same function na ...

  6. kotlin 或 运算_Kotlin程序对两个数字执行算术运算

    kotlin 或 运算 Here, we are implementing a Kotlin program to perform various arithmetic operations on t ...

  7. kotlin字符串数组_Kotlin程序读取,遍历,反向和排序字符串数组

    kotlin字符串数组 Given a string array, we have to read, traverse, reverse and sort its elements. 给定一个字符串数 ...

  8. kotlin获取属性_Kotlin程序| 属性获取器和设置器方法的示例

    kotlin获取属性 属性获取器和设置器方法 (Properties Getter and Setter Methods) Variable having a class-level scope, d ...

  9. kotlin实现继承_Kotlin程序| 继承的例子

    kotlin实现继承 遗产 (Inheritance) Inheritance is a mechanism wherein a new class is derived from an existi ...

最新文章

  1. 睡眠不足,记忆力还有救吗?Nature:饿着
  2. python多线程队列和池_Python3 从零单排28_线程队列进程池线程池
  3. MySQL配置主从同步过程记录
  4. Lua与Redis交互
  5. 西门子新款A系列手机【ZZ】
  6. 公司高层要我转Java 我直接邮件回怼...
  7. Spring Web应用程序的最大缺陷
  8. php 登录记住密码,php 记住密码自动登录
  9. 08-Scrum过程-办公环境 每日立会(Standup Meeting)
  10. SQL Server where语句使用举例
  11. SQL存储过程和函数区别(超级简单,人人都可以看懂)
  12. java小红球下载_小红球闯关下载_小红球闯关合集版下载-游戏下载
  13. 用自己的APP打开微信和支付宝付款码和扫一扫界面
  14. 聚力优创:拼多多的店铺怎么引流?秘诀分享
  15. HP-UX Samba服务配置手册
  16. 2014新浪校招笔试题:取水果(17年第一篇让人懵逼的面试题)
  17. Python脚本操作Excel实现批量替换
  18. No module named en 的解决办法spacy
  19. 基于802.11n物理层的OFDM通信链路simulink仿真,包括FEC编码、插入导频、OFDM成帧、STBC编码
  20. linux内核网络参数tcp_tw_recycle 和 tcp_tw_reuse 你搞清楚了吗?

热门文章

  1. $.fn.zTree 展开 回显 选中
  2. React中ref的使用方法
  3. 被嫌弃的eval和with
  4. 纯CSS实现圆角边框
  5. css盒模型中margin很牛逼
  6. ASP.NET Core Razor Pages
  7. js中使用0 “” null undefined {}需要注意
  8. JAVA Swing 组件演示***
  9. 平衡二叉树,AVL树之图解篇
  10. SP2010开发和VS2010专家食谱--第三章节--高级工作流(2)--为沙盒解决方案创建自定义活动...