Format number using decimal format in kotlin

后端 未结 4 773
渐次进展
渐次进展 2021-01-17 11:46

I am facing an issue where I need to do some calculations with a number like for example 5000,00 multiplied it by (1,025^3).

So in

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-17 12:01

    Used:

    %.numberf
    
    fun main(args: Array) {
    var A: Double
    A = readLine()!!.toDouble()
    var bla = A*A
    var calculator = 3.14159 * bla
    println("A=%.4f".format(calculator))
    }
    

提交回复
热议问题