Skip to content

Instantly share code, notes, and snippets.

@developer--
Created February 14, 2019 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developer--/d7cf741810cddda399fa6a732146ccdb to your computer and use it in GitHub Desktop.
Save developer--/d7cf741810cddda399fa6a732146ccdb to your computer and use it in GitHub Desktop.
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