JAVA:
@Test
public void test11() {
for (int i = 1; i < 10; i++) {
for (int j = 1; j <= i; j++) {
System.out.print(i + "*" + j + "=" +i*j +" ");
}
System.out.println("\t");
}
python:
for i in range(1,10):
for j in range(1,i+1) :
print("%d*%d=%2d" %(j,j,i*j),end="\t")
print(" ")
Shell脚本:
#!/bin/bash/
for((i=0;i<10;i++))
do
for((j=1;j<=i;j++))
do
((product=$i*$j))
echo -ne $i*$j=$product" "
done
echo
done
exit
Scala语言:
for(i <- 1 to 9) {
for(a <- 1 to (i)) {
print(i + "*" +a + "=" + i*a + "\t" )
}
println(" ")
}
}