Java-Function exercises

Source: Internet
Author: User
/* 1. Define a function used to print the rectangle 1. Define a function */class functiontest {public static void main (string [] ARGs) that prints the multiplication table of 9-9 characters) {draw (5, 5); Fenge (); Draw (8, 8); Fenge (); print99 ();}/* defines a function used to print the rectangular train of thought: 1. Confirm the result: no, because the rectangle 2 is printed directly. Is there any position content? There are two, because the rows and columns of the rectangle are not sure */public static void draw (INT row, int col) {int I, j; for (I = 0; I <row; I ++) {for (j = 0; j <Col; j ++) {system. out. print ("*");} system. out. println () ;}/// split line public static void Fenge () {system. out. println ("-----------------------");}/* print the 9-9 multiplication table */public static void print99 () {for (INT I = 1; I <= 9; I ++) java {for (Int J = 1; j <= I; j ++) {system. out. print (I + "*" + J + "=" + I * j + "\ t");} system. out. println ();}}}

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.