题目:输出9*9口诀。
1、9行9列的乘法口诀:
package cn.ls.lanqiao;
public class Test16 {
public static void main(String[] args) {
int i = 0;
int j = 0;
for (i = 1; i <= 9; i++) {
for (j = 1; j <= 9; j++)
System.out.print(i + "*" + j + "=" + i * j + "\t");
System.out.println();
}
}
}
2、不出现重复的乘积(下三角):
package cn.ls.lanqiao;
public class Test16 {
public static void main(String[] args) {
int i = 0;
int j = 0;
for (i = 1; i <= 9; i++) {
for (j = 1; j <= i; j++)
System.out.print(i + "*" + j + "=" + i * j + "\t");
System.out.println();
}
}
}
3、上三角:
package cn.ls.lanqiao;
public class Test16 {
public static void main(String[] args) {
int i = 0;
int j = 0;
for (i = 1; i <= 9; i++) {
for (j = i; j <= 9; j++)
System.out.print(i + "*" + j + "=" + i * j + "\t");
System.out.println();
}
}
}