*
***
*****
*******
*********
*******
*****
***
*
*
***
*****
*******
*********
*******
*****
***
*
收起
import java.util.*;
public class LXing
{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int i , j ;
int n = in.nextInt();//如果是打印固定大小的菱形,可以把这个输入的值改为定值
for(i=1; i<=n; i++)
{
for(j=1; j<=n-i; j++)
System.out.printf(" ");
for(j=1; j<=2*i-1; j++)
System.out.printf("*");
System.out.printf("%n");
}
for(i=n-1; i>=1; i--)
{
for(j=i; j<=n-1; j++)
System.out.printf(" ");
for(j=1; j<=2*i-1; j++)
System.out.printf("*");
System.out.printf("\n");
}
}
}
报告相同问题?