Skip to content

Instantly share code, notes, and snippets.

@developer-- developer--/Main.kt
Created Feb 14, 2019

Embed
What would you like to do?
min_max_ex
import java.util.*
fun main(args: Array<String>) {
val scanner = Scanner(System.`in`)
var max = Int.MIN_VALUE
var min = Int.MAX_VALUE
println("stop symbol input")
val stopSymbol = scanner.next()
println("sheitanet ricxvebi")
while (true) {
val n1 = scanner.next()
if (n1 == stopSymbol){
println("morcha")
break
}else {
val num = n1.toInt()
if (num > max){
max = num
}
if (num < min){
min = num
}
}
}
println("MAX $max \n MIN $min")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.