Kotlin Program to Add Two Integers

In this post, we will learn how to write a Kotlin program to add two numbers.
In this program, you'll learn to store and add two integer numbers in Kotlin. After addition, the final sum is displayed on the screen.

Kotlin Program to Add Two Integers

package com.kotlin.programs

fun main(args: Array < String > ) {

    val number1: Int = 10
    val number2: Int = 20

    val sum = number1 + number2

    println("The sum is: $sum")
}
Output:
The sum is: 30



Comments