+ 3
How i get only Integer Part of number if the decimal part = 0 in Kotlin ?
Exemple : x = 300.0 i want print 300 but if = 300.54 i want print 300.54.
1 Antwort
+ 7
//try this
var x = 300.0 // or 300.54
if(x%1==0.0){
println(x.toInt())
}
else {
println(x)
}