Enter an integer n (0<n<2147483647) to print a triangle consisting of "*"

Source: Internet
Author: User

Describe
Enter an integer n (0<n<2147483647) to print a triangle consisting of "*", as
Input
The first line has an integer n (0<n<2147483647)
Output
"*" composed of triangles

650) this.width=650; "style=" WIDTH:150PX;HEIGHT:197PX; "src=" Http://s2.51cto.com/wyfs02/M02/85/AD/wKiom1er_ Bdsms9-aaadctzv-ho491.png-wh_500x0-wm_3-wmp_4-s_4254989297.png "title=" Sogou 20160811122250.png "border=" 0 "height=" 197 "hspace=" 0 "vspace=" 0 "width=" "alt=" Wkiom1er_bdsms9-aaadctzv-ho491.png-wh_50 "/>

Public class main {    public static void main (String[] &NBSP;ARG) {        int n = 0;         scanner scanner = new scanner (system.in);         n = scanner.nextint ();         Scanner.close ();        for  (int i = 1; i  <= n; i++)  {             for  (int j = 0; j < n-i; j++)  {                 system.out.print (" ");             }             for (int p = 0; p < i; p++) {                 system.out.print ("*");             }             System.out.println ();         }    }}


This article from "Endless life, toss more than" blog, please be sure to keep this source http://admxj.blog.51cto.com/10955090/1836825

Enter an integer n (0<n<2147483647) to print a triangle consisting of "*"

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.