Java console input Digital output multiplication table (code exercise)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.