import kotlin.math.sqrt
// When a square root is a whole number, then the number is a perfect square number
fun isPerfectSquare(number: Int): Boolean {
if (number >= 0) {
val dSqrt = sqrt(number.toDouble())
return dSqrt == dSqrt.toInt().toDouble()
}
return false
}
fun main() {
val num = 81
if (isPerfectSquare(num)) {
println("$num is a perfect square")
} else {
println("$num is not a perfect square")
}
}
/*
run:
81 is a perfect square
*/