package 打印图形;
public class TestlDrwing {
public static void main(String[] args) {
lx();
}
public static void zfx(){
//打印5*5正方形
for(int i = 1;i<=5;i++){
for(int j = 1;j<=5;j++){
System.out.print("*");
}
System.out.println();
}
}
public static void pxsbx(){ //打印平行四边形
for(int i = 1;i<=5;i++){
for(int k =1;k<=5-i;k++){
System.out.print(" ");
}
for(int j = 1;j<=5;j++){
System.out.print("*");
}
System.out.println();
}
}
public static void sjx(){ //打印三角形
for(int i = 1;i<5;i++){
for(int j=1;j<=5-i;j++){
System.out.print(" ");
}
for(int k = 0;k<2*i-1;k++){
System.out.print("*");
}
System.out.println();
}
}
public static void lx(){ //打印菱形
for(int i = 1;i<5;i++){
for(int j=1;j<=5-i;j++){
System.out.print(" ");
}
for(int k = 0;k<2*i-1;k++){
System.out.print("*");
}
System.out.println();
}
for(int q = 1;q<=4;q++){
for(int w=1;w<=q;w++){
System.out.print(" ");
}
for(int e = 1;e<=7-2*(q-1);e++){
System.out.print("*");
}
System.out.println();
}
}
}
|