Package HHL; public class Jiujiu {public static void main (string[] args) {Zuoshang ();//Call the function of the multiplication table on the left is Zuoxia ();//Call Output the function of the lower-left multiplication table Shang ()//Call the function of the multiplication table on the right of the output youxia ();/Call output function of the multiplication table in the lower right () public static void Zuoshang ()//defines the function {for (int i=1;i<=9;i++
//The nested output of the For statement is 99 multiplication table {for (int j=1;j<=i;j++) {System.out.print (j+ "*" +i+ "=");
System.out.printf ("%-4d", i*j);
} System.out.println ();
The public static void Zuoxia ()//defines the function {{System.out.println () of the lower-left multiplication table of the output;
for (int i=9;i>=1;i–)//IBID. {for (int j=1;j<=i;j++) {System.out.print (j+ "*" +i+ "=");
System.out.printf ("%-4d", i*j);
} System.out.println (); The function {{for (int i=1;i<=9;i++)/+ of the multiplication table on the right of the public static void Youshang ()//is defined as {for (int. j=i;j<9;j++) {Syst
Em.out.print ("T");
for (int j=i;j>0;j--) {if ((i*j) <10) System.out.print ("" +j+ "*" +i+ "=" + (i*j) + "T");
else System.out.print (+j+ "*" +i+ "=" + (i*j) + "T");
} System.out.println (); } SysTem.out.println (); The public static void Youxia ()//defines the function of the multiplication table in the lower right of the output {for (int i=9;i>0;i–)//IBID. {for (int j=0;j<9-i;j++) {System.ou
T.print ("T"); for (int j=i;j>0;j--) {if (i*j) <10, System.out.print ("" +j+ "*" +i+ "=" +
(i*j) + "T");
else System.out.print (+j+ "*" +i+ "=" + (i*j) + "T");
} System.out.println (); }
}
}
The
results are as follows:
The knowledge point of this experiment:
1,for The Loop statement and the IF statement in the nested use. Define functions and Invocations in Java.
2, the mastery of the knowledge of the 99 multiplication table, and the attempts of various output methods.
The summary of this experiment:
1, the understanding and mastery of functions in Java,
2, the use of multiple loops to make the program more concise and understandable.
3, the lack of self, for the calculation of this aspect of the thinking is not very strong, and the software operation is not familiar, hope to improve next time.