Java Console print Triangle area

Source: Internet
Author: User

public class Triangle {public static void main (string[] args) {a ();//print positive isosceles triangle B ();//print Inverted isosceles triangle C ();//print straight edge left upright angle triangle d ();//Print Straight Edge on Right angle triangle E (); Print straight edge on left inverted right angle triangle f (); Print straight edge on right inverted triangle g (); Print bottom edge left obtuse angle triangle H (); Print bottom Right angle triangle}/** * Function: Print positive isosceles triangle */public static void A () {System.out.println ("Print positive isosceles triangle"); int i, j;for (i=1;i<=5;i++) { for (j=5;j>i;j--) {System.out.print ("");} for (j=0;j<i*2-1;j++) {System.out.print ("*");} System.out.println ();}} /** * Print inverted isosceles triangle */public static void B () {System.out.println ("Print inverted isosceles triangle"), int i, J; for (i=1;i<=5;i++) {for (j=1;j<i;j++) {System.out.print ("");} for (j=10;j>i*2-1;j--) {System.out.print ("*");} System.out.println ();}} /** * Print straight edge on left upright angle triangle */public static void C () {System.out.println ("Print straight edge on left upright angle triangle"); int i, J; for (i=1;i<=5;i++) {for (j=0;j <i;j++) {System.out.print ("*");} System.out.println ();}} /** * Print straight edge on right angle triangle */public static void D () {System.out.println ("Print straight edge on Right angle triangle"); int i, j;for (i=1;i<=5;i++) {for (j=5;j >i;j--) {System.out.print ("");} for (j=0;j<i;j++) {System.out.print ("*");}system.out.println ();}} /** * Print straight edge on left inverted right angle triangle */public static void E () {System.out.println ("Print straight edge on left inverted triangle"); int i, j;for (i=1;i<=5;i++) {for (j=5;j >=i;j--) {System.out.print ("*");} System.out.println ();}} /** * Print straight edge on right inverted triangle */public static void F () {System.out.println ("Print straight edge right inverted triangle"); int i, j;for (i=1;i<=5;i++) {for (j=1;j <i;j++) {System.out.print ("");} for (j=5;j>=i;j--) {System.out.print ("*");}    System.out.println ();}}    /** * Print bottom edge left obtuse angle triangle */public static void G () {System.out.println ("Print bottom edge left obtuse angle triangle");    int I, J;    for (i=1;i<=5;i++) {for (j=0;j<i;j++) {System.out.print ("*");    } System.out.println ();    } for (i=1;i<5;i++) {for (j=5;j>i;j--) {System.out.print ("*");    } System.out.println ();    }}/** * Print bottom right angle triangle */public static void H () {System.out.print ("Print bottom Right angle triangle");    int i,j;    for (i=0;i<=5;i++) {for (j=5;j>i;j--) {System.out.print ("");    } for (j=0;j<i;j++) {System.out.print ("*"); } SystEm.out.println ();    } for (i=1;i<5;i++) {for (j=0;j<i;j++) {System.out.print ("");    } for (j=5;j>i;j--) {System.out.print ("*");    } System.out.println (); }    }}

Java Console print Triangle area

Related Article

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.