Multiplication tables: Difference between revisions

m (→‎JS ES6: (minor tidying))
Line 4,105:
 
=={{header|Scala}}==
<lang scala>//Multiplication Table
//Multiplication Table
print(" %5s" + i + .format("|" ))
for (i <- 1 to 12) print("%5d".format(i))
println("")
println("-----" * 13)
 
for( (i <- 1 to 12 ) {
object mulTable{
print("%4d|".format(i))
def main( args:Array[String] ){
 
for( (j <- 1 to 12 ) {
print(" |") //Horizontal row
for( i <- 1 toif 12(i <= j)
print("%5d".format(i * j))
if( i<10 )
else
print( " " + i )
print("%5s".format(""))
else
}
print(" " + i )
 
println("")
println("")
println("---------------------------------------------------------------------")
}
}</lang>
for( i <- 1 to 12 ){
if( i<10 ) //Vertical column
print(" " + i + "|" )
else
print(" " + i + "|" )
for( j <- 1 to 12 ){
if( i*j < 10 ){
if( i<=j )
print(" " + i*j )
else
print(" ")
}
else if( i*j < 100 ){
if( i<=j )
print(" " + i*j )
else
print(" ")
}
else{
if( i<=j )
print(" " + i*j )
else
print(" ")
}
}
println("")
}
}
}</lang>
 
=={{header|Scheme}}==
Anonymous user