p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; min-height: 12.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; color: #931a68 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; color: #4e9072 }
span.s1 { color: #931a68 }
span.s2 { color: #000000 }
span.s3 { color: #7e504f }
span.s4 { color: #0326cc }
span.s5 { color: #3933ff }
span.s6 { text-decoration: underline; color: #7e504f }
span.s7 { color: #91afcb }
span.Apple-tab-span { white-space: pre }
package basicProject;
public class Tuxing extends Basic {
public void picture1() {
final int COUNT = 10;
int row = 5;
for (int i=1; i<=row; i++) {
for(int k=0;k<i;k++) {
if (k==0) {
System.out.print("");
}else {
System.out.print(" ");
}
}
for(int j=0;j<=COUNT;j++) {
if (j!=COUNT) {
System.out.print("*");
}else {
System.out.print("*"+"\n");
}
}
}
}
public void picture2() {
int count = 10;
int row = 10;
for (int i=0;i<row;i++) {
for(int k=row;k>=i;k--) {
if(k==row) {
System.out.print("");
}else {
System.out.print(" ");
}
}
System.out.print("**********"+"\n");
}
}
public void picture3() {
int row = 10;
for(int i=1;i<=row;i++) {
if(i<=row/2+1) {
for(int j=1;j<=i;j++) {
System.out.print("*");
}
System.out.println();
}
if(i>row/2+1) {
for(int k=i;k<=row;k++) {
System.out.print("*");
}
System.out.println();
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Tuxing picture = new Tuxing();
picture.picture3();
picture.picture1();
picture.picture2();
}
}
原文地址:https://www.cnblogs.com/EmilyGarden/p/8555276.html