RosettaCodeData/Task/Multiplication-tables/Scala/multiplication-tables-1.scala
2019-09-12 10:33:56 -07:00

18 lines
303 B
Scala

//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("")
}