Packagech02; Public classJIUJIUCHENGFA { Public Static voidMain (string[] args) {//TODO Auto-generated method stubs//------99 Multiplication Table----- for(inti=1;i<=9;i++) { for(intj=1;j<=9;j++) {System.out.print (i+ "*" + j + "=" + i*j + "\ T"); } System.out.println (""); } }}
The results appear as follows:
----------------------------------------------------------------------------
1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9
2*1=22*2=42*3=62*4=82*5=102*6=122*7=142*8=162*9=18
3*1=33*2=63*3=93*4=123*5=153*6=183*7=213*8=243*9=27
4*1=44*2=84*3=124*4=164*5=204*6=244*7=284*8=324*9=36
5*1=55*2=105*3=155*4=205*5=255*6=305*7=355*8=405*9=45
6*1=66*2=126*3=186*4=246*5=306*6=366*7=426*8=486*9=54
7*1=77*2=147*3=217*4=287*5=357*6=427*7=497*8=567*9=63
8*1=88*2=168*3=248*4=328*5=408*6=488*7=568*8=648*9=72
9*1=99*2=189*3=279*4=369*5=459*6=549*7=639*8=729*9=81
----------------------------------------------------------------------------
Diagonal Triangle 99 Multiplication
Package Ch02;public class Jiujiuchengfa {public static void main (string[] args) {//TODO auto-generated method stub//------99 multiplication Table-----for (int i=1;i<=9;i++) {for (int j=1;j<=i;j++) {System.out.print (i + "*" + j + "=" + I*j + "\t\t"); } System.out.println ("");}}
1*1=1
2*1=22*2=4
3*1=33*2=63*3=9
4*1=44*2=84*3=124*4=16
5*1=55*2=105*3=155*4=205*5=25
6*1=66*2=126*3=186*4=246*5=306*6=36
7*1=77*2=147*3=217*4=287*5=357*6=427*7=49
8*1=88*2=168*3=248*4=328*5=408*6=488*7=568*8=64
9*1=99*2=189*3=279*4=369*5=459*6=549*7=639*8=729*9=81
Java Learning Lesson 5th, looping function