Kotlin Program to find the greatest number of three numbers

In this program, You will learn how to find the greatest number among the three numbers in Kotlin.

10 20 30 => 30

20 10 19 => 20

Example: How to find the greatest number of three numbers in Kotlin.

import java.util.Scanner

fun main(args: Array<String>) {

    var a: Int
    var b: Int
    var c: Int

    var sc = Scanner(System.`in`)

    print("Enter three numbers:")
    a = sc.nextInt()
    b = sc.nextInt()
    c = sc.nextInt()

    if (a > b && a > c) {
        println("Greatest is :$a")
    } else if (b > c) {
        println("Greatest is :$b")
    } else {
        println("Greatest is :$c")


Enter three numbers:10 20 15
Greatest is :20

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.