import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= n - i; j++){
System.out.print(" ");
}
for(int j = 1; j <= 2 * i - 1; j++){
System.out.print("*");
}
System.out.println();
}
for(int i = n - 1; i >= 1; i--)
{
for(int j = n - 1; j >= i; j--){
System.out.print(" ");
}
for(int j = 2 * i - 1; j >= 1; j-- ){
System.out.print("*");
}
System.out.println();
}
}
}
java实验---打印菱形
最新推荐文章于 2022-12-31 18:19:05 发布