Advertisement
Guest User

Untitled

a guest
Mar 12th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.41 KB | None | 0 0
  1. import scala.io.Source
  2. object IO extends App {
  3.  
  4.   do {
  5.   println("I can has multiply?")
  6.   val param = Console.readLong()
  7.   printMult(param)
  8.   println("Type y to repeat.")
  9.   } while (Console.readChar() != 'n')
  10.  
  11.   def printMult(mult: BigInt): Unit = {
  12.     var sum : BigInt = 0
  13.     for (i <- (1 to 10)) {
  14.       println(i + "\t" + i * mult);
  15.       sum += i * mult;
  16.     }
  17.     println("Sum: " + sum)
  18.  
  19.   }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement