This Kotlin example shows how to store and add two integer numbers in Kotlin. After addition, the final sum is displayed on the screen.
Kotlin - Add Two Numbers Example
package net.javaguides.kotlin.examples
fun main(args: Array<String>) {
val first: Int = 25
val second: Int = 25
val sum = first + second
println("The sum is: $sum")
}
Output:
The sum is: 50
Free Spring Boot Tutorial - 5 Hours Full Course
Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course