title: How to pass input in scala through command line
body: <pre><code>  import scala.io._    
  
    object Sum {    
       def main(args :Array[String]):Unit = {    
  
        println("Enter some numbers and press ctrl-c")
  
       val input = Source.fromInputStream(System.in)
  
       val lines = input.getLines.toList
  
       println("Sum "+sum(lines))
  
     }
  
     def toInt(in:String):Option[Int] =
  
        try{
  
          Some(Integer.parseInt(in.trim))
  
        }
  
        catch    {
         case e: NumberFormatException =&gt; None    
     } 
  
     def sum(in :Seq[String]) = {
  
       val ints = in.flatMap(s=&gt;toInt(s))
  
        ints.foldLeft(0) ((a,b) =&gt; a +b)
  
       } }
  </code></pre>
  
  <p>I am trying to run this program  after passing input I have press
     ctrl + c but </p>
  
  <p>It gives this message E:\Scala>scala HelloWord.scala Enter some
     numbers and press ctrl-c 1 2 3 Terminate batch job (Y/N)?</p>