Answers for "compound interest formula kotlin"

0

compound interest formula kotlin

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")
}
Posted by: Guest on March-14-2021

Code answers related to "compound interest formula kotlin"

Browse Popular Code Answers by Language