Kotlin Program to Find ASCII value of a character : To find the ASCII value of ch, we use a Kotlin’s built-in function called toInt(). This converts a Char value into an Int value. This converted value is then stored in a variable ASCII. Finally, we print the ASCII value using the println() function.
Kotlin Program to Find ASCII value of a character
Source Code
fun main(args: Array) {
val c = 'a'
val ascii = c.toInt()
println("The ASCII value of $c is: $ascii")
}
Output
Kotlin Program to Find ASCII value of a character