import java.util.Scanner;
class Six {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入一个数字:");
int n=sc.nextInt();
for (int x=1;x<=4*n/3 ;x++ ){
for (int y=1;y<=(2*n-1); y++){
if (y==(n-x+1)||y==(n+x-1)||(y%2==1&&x==n)||
(y%2==1&&x==n/3+1)||y==(7*n/3-x)||y==(x-n/3)){
System.out.print("*");
}else {
System.out.print(" ");
}
}
System.out.println();
}
}
}
以上是源码
|
|