===>NO.8
public class Test8 {
/**
* 用一个for循环输出9x9乘法表
*/
public static void main(String[] args) {
for(int i=1,j=1;j<=9;i++){
System.out.print(j+"X"+i+"="+j*i+" ");
if(i==j){
i=0;
j++;
System.out.println();
}
}
}
}
===>NO.9
public class Test9 {
/**
* 打印杨辉三角
*/
public static void main(String[] args) {
int a [][];
a=new int[11][];
for(int i=1;i<=10;i++){
a[i]=new int[i+1];
for(int j=1;j<=i;j++){
if(i==1||i==j){
a[i][j]=1;
System.out.println(a[i][j]);
}else{
a[i][j]=a[i-1][j-1]+a[i-1][j];
System.out.print(a[i][j]+" ");
}
}
}
}
}