Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
//Multiplication Table
|
||||
print("%5s".format("|"))
|
||||
for (i <- 1 to 12) print("%5d".format(i))
|
||||
println()
|
||||
println("-----" * 13)
|
||||
|
||||
for (i <- 1 to 12) {
|
||||
print("%4d|".format(i))
|
||||
|
||||
for (j <- 1 to 12) {
|
||||
if (i <= j)
|
||||
print("%5d".format(i * j))
|
||||
else
|
||||
print("%5s".format(""))
|
||||
}
|
||||
|
||||
println("")
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
implicit def intToString(i: Int) = i.toString
|
||||
val cell = (x:String) => print("%5s".format(x))
|
||||
|
||||
for {
|
||||
i <- 1 to 14
|
||||
j <- 1 to 14
|
||||
}
|
||||
yield {
|
||||
(i, j) match {
|
||||
case (i, 13) => cell("|")
|
||||
case (i, 14) if i > 12 => cell("\n")
|
||||
case (13, j) => cell("-----")
|
||||
case (i, 14) => cell(i + "\n")
|
||||
case (14, j) => cell(j)
|
||||
case (i, j) if i <= j => cell(i*j)
|
||||
case (i, j) => cell("-")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue