如题所述
public static void main(String[]args){
for(int i=1;i<10;i++){
System.out.print(i+" ");
for(int j=1;j<=i;j++){
System.out.print(i*j + " ");
}
System.out.println();
}
}
}追问
不是这样的效果,能不能帮我再改一下,就是最边上的两行,还有最开头的地方还有一个乘号(*)这些也要显示的!边上还有 虽然不是乘号,但是就是隔开的意思
*=123456789
===============
1=
2=
3=
4=
5=
6=
7=
8=
9=
就是java实现九九乘法表啊!效果如下:
* 1 2 3 4 5 6 7 8 9
1 1
2 2 4
3 3 6 9
4 4 8 12 16
5 5 10 15 20 25
6 6 12 18 24 30 36
7 7 14 21 28 35 42 49
8 8 16 24 32 40 48 56 64
9 9 18 27 36 45 54 63 72 81 了解了吗?麻烦你咯,谢谢高手咯
public class ChengFaBiao {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ChengFaBiao.cfb();
}
static void cfb(){
System.out.println(" * 1 2 3 4 5 6 7 8 9");
int k = 1;
for(int i=1;i<=9;i++){
for(k=1;k<=i;k++){
if(k==1)
System.out.print(i+"=");
System.out.print(" "+i*k);
}
System.out.println("");
}
}
}