IO-08. Output inverted triangle pattern (for loop write does not match, with stupid println, % >_<%)

Source: Internet
Author: User

This question requires a program to output the specified inverted triangle pattern consisting.

Input Format:This topic is not entered.

Output Format:Output an inverted triangle pattern consisting of "*" in the following format.

**********
Note: follow the following style strictly.

I can't write it out of the for loop, so I had to use the stupid println line of output.

 public class Main {     public static void main(String[] args)      {          System.out.println("* * * *");          System.out.println(" * * *");          System.out.println("  * *");          System.out.print("   *");        }}

 Which one wrote it by hand? Please leave a message and learn it!

As shown in the following figure, the output is a little similar, but it still does not conform to the above.

Public class main {public static void main (string [] ARGs) {for (INT I = 4; I> 0; I --) {for (Int J = 0; j <4-I; j ++) {system. out. print (""); // control the number of spaces before each line *. The first line has 0 spaces, and the second line has 1 space ...... // The number of spaces is dynamic, so I in the previous for is used for control. } For (int K = 0; k <I; k ++) {system. Out. Print ("*");} if (I! = 1) system. Out. println ();}}}
Output result:

 

IO-08. Output inverted triangle pattern (for loop write does not match, with stupid 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.