如果希望維持小數點兩位的結果的話,可以使用 format() 來達成 println("%.2f".format(result)) // 4.57. roundToInt() 則可以四捨五入取到整數 println(result.
確定! 回上一頁