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 = 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 计算平方

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/378022.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

近代科学为什么诞生在西方-1

宽泛的讲&#xff0c;近代科学是几种文明在长达几个世纪的持续交流碰撞中产生的。它正在日益成为全世界全人类都有效的普适科学。通向现代科学之路就是通向自由和开放交流之路。 马克思韦伯和莫顿都认为&#xff0c;科学事业要持续的进步就要特定的文化和制度的支持。 中国的数…

九、图像直方图

一、图像直方图的属性 说白了就是将图像上的各个颜色通道上的像素点的像素值进行统计&#xff0c;例如&#xff1a;像素值为14的像素点个数有几个&#xff0c;进行显示。 图像的像素值取值范围为[0,255]&#xff0c;这个范围也成为直方图的range也就是直方图的横坐标轴 每一个…

BIFR的完整形式是什么?

BIFR&#xff1a;工业和金融重组委员会 (BIFR: Board of Industrial and Financial Reconstruction) BIFR is an abbreviation of the Board of Industrial and Financial Reconstruction. It was an organization of the Government of India and a branch of the Department …

LeetCode 101. 对称二叉树 思考分析

题目 给定一个二叉树&#xff0c;检查它是否是镜像对称的。 例如&#xff0c;二叉树 [1,2,2,3,4,4,3] 是对称的。 1/ 2 2 / \ / 3 4 4 3 但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的: 1/ 2 2 \ 3 3 进阶&#xff1a; 你可以运用递归和迭代两种方法解决这个…

内心能不能宁静一点,做事能不能坚持一下

内心能不能宁静一点&#xff0c;做事能不能坚持一下 每次朋友问我怎么样&#xff0c;我总感觉不好回答&#xff0c;如果说实话我想他们或许是不能理解我的处境的&#xff0c;只能报以“还好”之类的语言&#xff0c;糊弄一下。唯一一次说了实话是&#xff1a;我坠落了&#xff…

直方图反向投影

通过直方图反向投影&#xff0c;根据目标衣服颜色的特征来进行定位 cv2.calcHist([roi_hsv],[0,1],None,[32,48],[0,180,0,256])其中[32,48]表示bin的个数&#xff0c;可以修改&#xff0c;当然范围越小越精确 import cv2 import numpy as np from matplotlib import pyplot …

javascript 排序_JavaScript中的排序方法

javascript 排序There are tons of sorting algorithms available like bubble sort, merge sort, insertion sort etc. You must have implemented some of these in other programming languages like C or C. But in this article, I will be demonstrating the Sorting met…

LeetCode 二叉树、N叉树的最大深度与最小深度(递归解)

目录104. 二叉树的最大深度559. N叉树的最大深度111. 二叉树的最小深度之前的笔记中&#xff0c;已经用层序遍历解决过这个问题了现在试着用深度的解法去求解104. 二叉树的最大深度 给定一个二叉树&#xff0c;找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径…

十、模板匹配

一、概念 模板匹配就是在整个图像区域发现与给定子图像匹配的小块区域。 需要首先给定一个模板图像A&#xff0c;和一个待检测图像B。 在待检测图像B上&#xff0c;从左往右&#xff0c;从上往下计算待检测图像B和模板图像A所重叠的匹配度&#xff0c;匹配度越高则两者相同的可…

基于WF的意见征集4(浅析)

接口项目&#xff1a;IClass&#xff08;项目名称&#xff09; HTHuiFuusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Workflow.Runtime;using System.Workflow.Activities;namespace IClass{ /// <summary> /…

那些VisualStudio隐藏的调试功能

VisualStudio是一个强大的调试工具&#xff0c;里面很多隐藏功能少有人问津&#xff0c;但是在特定场景可以节省你很多时间&#xff0c;本文主要介绍一些VisualStudio调试相关的隐藏功能&#xff0c;欢迎大家补充。 运行到指针(Run to cursor) 大多数人用Visual Studio在调试程…

php连接数据库代码_PHP代码连接各种数据库

php连接数据库代码1)用PHP连接MySQL (1) Connecting with MySQL in PHP) <?php$host "localhost";$uname "username";$pw "password";$db "newDB";try {$conn new PDO("mysql:host$host;dbname$db", $uname, $pw);…

【C++ grammar】对象和类(创建对象、对象拷贝、分离声明与实现)

目录1、用类创建对象1、面向对象的特征2、对象由什么构成3、如何定义对象4、创建对象并访问对象成员1. Constructors(构造函数)2. Constructing Objects (创建对象)3. Object Member Access Operator(对象访问运算符)2、对象拷贝以及分离声明与实现1、类是一种数据类型1.1. 定义…

十一、图像二值化

一、二值图像 其实就是把图像转换为只有黑白的两种颜色图像&#xff0c;即像素值非零即一 三角阈值二值化 对一个图像进行操作&#xff0c;获取图像的直方图&#xff0c;找到波峰和波谷进行连线设为线段A&#xff0c;每个点做有关线段A的垂线垂足在线段A上&#xff0c;最后将…

百度地图LV1.5实践项目开发工具类bmap.util.jsV1.2

/*** 百度地图使用工具类-v1.5* * author boonya* date 2013-7-7* address Chengdu,Sichuan,China* email boonyasina.com* company KWT.Shenzhen.Inc.com* notice 有些功能需要加入外部JS库才能使用&#xff0c;另外还需要申请地图JS key .* 申请地址&#xff1a;http…

isatty_带有示例的Python File isatty()方法

isatty文件isatty()方法 (File isatty() Method) isatty() method is an inbuilt method in Python, it is used to check whether a file stream is an interactive or not in Python i.e. a file stream is connected to a terminal device. If a file is connected to a ter…

地毯店 如何辨别地毯的好坏?

在实地选购地毯品牌时&#xff0c;许多地方需要引起注意&#xff0c;而且要显得专业&#xff0c;这样才能科学深入地辨别地毯的好坏。比如&#xff0c;辨明拉绞地毯和抽绞地毯两种工艺的打结方法几乎相同&#xff0c;只是变绞形式上有所区别。抽绞的方式较古老&#xff0c;一般…

十二、图像金字塔

一、原理 reduce高斯模糊降采样 expand扩大卷积 PyrDown&#xff1a;降采样 PyrUp&#xff1a;还原 二、高斯金字塔 import cv2 import numpy as np from matplotlib import pyplot as pltdef pyramid(image):level 3temp image.copy()pyramid_image []for i in range(le…

java uuid静态方法_Java UUID toString()方法与示例

java uuid静态方法UUID类toString()方法 (UUID Class toString() method) toString() method is available in java.util package. toString()方法在java.util包中可用。 toString() method is used for string denotation of this UUID. toString()方法用于此UUID的字符串表示…

LeetCode 110. 平衡二叉树思考分析

题目 给定一个二叉树&#xff0c;判断它是否是高度平衡的二叉树。 本题中&#xff0c;一棵高度平衡二叉树定义为&#xff1a; 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过1。 示例 1: 给定二叉树 [3,9,20,null,null,15,7] 3 / 9 20 / 15 7 返回 true 。 示例 2…