Created
February 14, 2019 13:56
-
-
Save developer--/d7cf741810cddda399fa6a732146ccdb to your computer and use it in GitHub Desktop.
min_max_ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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