Recently, I recalled some of the little exercises that I have practiced in Java. Feeling is quite interesting, in retrospect, think of a lot of learning experience and bumpy, a small exercise to study half a day, treasure the past, face the future. The following contribution code, Java console input digital output multiplication table (code exercise). Hope to give some beginners a little inspiration. Note write the comparison wordy, Hee ~
Because the blog Park has asked "less than 150 words of the essay is not allowed to publish to the home candidate area," So, a few lines of words ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah oh, ah oh oh
//I'm//function: 99 multiplication Table//time: 2018 1//involves keyboard input and requires a guide packageImportJava.util.Scanner; Public classjiujiu{ Public Static voidMain (String []args) {//Console Prompt TextSystem.out.print ("Please enter a number"); //Create Scanner inti; Scanner Reader=NewScanner (system.in); I=Reader.nextint (); //calling a method in a classJiujiu.xiangcheng (i); } //the logic of the multiplication table//define static methods for easy initialization of loading Static voidXiangcheng (intN) {intS=1; //I represent the number you entered, and also the multiplication table to express the layer out for(inti=1;i<=n;i++){ for(intj=1;j<=i;j++) {s=i*J; System.out.print (J+ "*" +i+ "=" +s+ ""); /*The following note is a 99 multiplication table if (s<10) {System.out.print (j+ "*" +i+ "=" +s+ "); }else System.out.print ("Please enter a number within 10"); */ } //spaces make the display clearerSystem.out.println (""); } }}
Pro-mapping:
Java console input Digital output multiplication table (code exercise)