Tuesday, February 12, 2019

Scala Hints

1)How to read the data from keyboard

val i:Int=scala.io.StdIn.readInt()
val i:Float=scala.io.StdIn.readFloat)
val i:String=scala.io.StdIn.readLine()


2)How to exit the program (status code is 1)

System.exit(status=1)

3)How to read the values by Array

for(I->0 to size-1)
a(I)=scala.io.StdIn.readInt()
println("The array is:"+a.mkString(","))







No comments:

Post a Comment

Python Challenges Program

Challenges program: program 1: #Input :ABAABBCA #Output: A4B3C1 str1="ABAABBCA" str2="" d={} for x in str1: d[x]=d...