title: Read integer from a line in scala
body: <h1>scala</h1>
  <p>I'm new to scala programming.i'm writing a code to read the integers from a line .what i did is :</p>
  <ol>
  <li>read the line of interger(1 2 4 5 6)</li>
  <li>read the character at 0,2,4,6 postion since space 1,3,5 are blank space,  but when it comes to read 10 only 1 is reed .</li>
  </ol>
  <p>my code is</p>
  <pre><code> val size: Int = Console.readInt // First line read the no of integers
      val reading: String = Console.readLine // String of integer(1 4 6 7 8)
  
      val readingSize: Int = reading.length
  
      var inp: Array[Int] = new Array[Int](size)
      for (a &lt;- 0 until readingSize if (a % 2 == 0)) inp(a / 2) = reading(a) //converting into integer array(will be ASCII value)
        println(&quot;Output : &quot; )
         for (b &lt;- 0 until inp.length) 
           print(inp(b).toChar + &quot; &quot; )
  </code></pre>
  <p>So for example for input (1 3 5 6 7) it works but for (1 2 10 9) it will stop at 1 2 1.</p>
  <p>i'ma beginner and so i don't whether this is completely bad logic for reading scala.
  Hope my question is clear
  Thanks in advance (and also input should in single with a single space between value)</p>