Kotlin - Add Two Numbers Example

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

Comments