编写程序打印乘法九九表。
package 乘法九九表;
public class PythagoreanTable {
public void compute(){
int i,j;
System.out.print("\t"+" ");
for(i=1;i<=9;i++)
System.out.print(i+"\t"+" ");
System.out.println();
for(i=1;i<=40;i++)
System.out.print("——");
System.out.println();
for(i=1;i<=9;i++){
System.out.print(i+" | "+"\t");
for(j=1;j<=9;j++)
System.out.print(i+"*"+j+"="+i*j+"\t");
System.out.println();
}
for(i=1;i<=40;i++)
System.out.print("——");
System.out.println();
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
PythagoreanTable pt = new PythagoreanTable();
for(int i=1;i<45;i++)
System.out.print(" ");
System.out.println("乘法九九表!");
System.out.println();
pt.compute();
}
}