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


Free Spring Boot Tutorial - 5 Hours Full Course


Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course