Class Triangle2{public static void Main (string[] args) {int x,y;for (x=1;x<=5;x+=1) {for (y=1;y<=x+5;y+=1) { System.out.print ("\ T"), while (y==6-x) {System.out.print ("*"); System.out.print ("\ t"); System.out.println ("*"), while (x==5) {System.out.println ("*" + "T" + "*" + "\ T" + "*" + "\ T" + "*" + "\ T" + "*" + "\ T" + "*" + "\ T" + "*" + "\" + " * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * ");
Compile display:
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/7F/FE/wKioL1c0A9rAUqIlAAAM5YPxa-U373.jpg "title=" 1.jpg " alt= "Wkiol1c0a9rauqilaaam5ypxa-u373.jpg"/>
Inverted triangle:
Class Triangle{public static void Main (string[] args) {int x,y;for (x=1;x<=5;x+=1) {while (x==1) {System.out.println (" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * "+" \ T "+" * ";} for (y=1;y<=10-x;y+=1) {System.out.print ("\ T"), while (y==x) {System.out.print ("*"); while (x<5) {System.out.println ("*");
Compile display:
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/80/01/wKiom1c0A56xkS2xAAAPYrnlYVo860.jpg "title=" 1.jpg " alt= "Wkiom1c0a56xks2xaaapyrnlyvo860.jpg"/>
This article is from the "Yehomlab" blog, make sure to keep this source http://yehom.blog.51cto.com/5159116/1772605
The experiment of "DAY2" output positive triangle and inverted triangle