import scala.math.BigInt
object LastDigitExample {
def main(args: Array[String]): Unit = {
// Example BigInt
val bigNumber: BigInt = BigInt("12345678901234567890123456789123")
// Get the last digit
val lastDigit: Int = (bigNumber % 10).toInt
println(s"The last digit of $bigNumber is: $lastDigit")
}
}
/*
run:
The last digit of 12345678901234567890123456789123 is: 3
*/