31ph4n70m

Maximum_of_array.kt

Nov 28th, 2019
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.44 KB | None | 0 0
  1. // kotlin solution to codeabbey challenge 15
  2.  
  3. fun main(args: Array<String>) {
  4.     var arr = readLine()!!.split(" ").map { it.toInt() }
  5.     var RSP = IntArray(300)
  6.     var max = 0
  7.     var min = 0
  8.     for (i in 0 until 300){
  9.         RSP[i] = arr[i]
  10.     }
  11.     for (j in 0 until 300){
  12.         if(RSP[j] > max){
  13.             max = RSP[j]
  14.         }else if(RSP[j] < min){
  15.             min = RSP[j]
  16.         }
  17.     }
  18.     println("$max $min")
  19. }
Add Comment
Please, Sign In to add comment