title: Read a sequence of numbers of undefined size & print the largest number & position of its first occurrence
body: <p>I need to read a sequence of numbers of undefined size &amp; prints the largest number &amp; the position of its first occurrence</p>
  <p>Can anyone help with this code:</p>
  <pre><code>import java.util.Scanner
  
  fun main() {
      val scan = Scanner(System.`in`)
      val num = scan.nextInt()
      var max = Int.MIN_VALUE
      var pos = 0
      var i = 1
  
      do {
          if (max &lt; num) {
              max = num
              pos = i
          }
          i++
      } while (scan.hasNext())
  
      print(&quot;$max $pos&quot;)
  }
  </code></pre>