package Test;
import java.util.Scanner;
public class TestLingXing02 {
public static void main(String[] args) {
// TODO 自动生成的方法存根
Scanner in=new Scanner(System.in);
int i,a,k,x;
double s;
System.out.println("请输入一个整数:");
a = in.nextInt();
for( i = 1; i <= a; i ++ )
{
if ( i <= ( a+1 ) / 2 )
{
x = 2* i-1;
}
else
{
x = 2 * (a-i) + 1;
}
s =50-x/2;
for ( k = 1; k < s; k ++ )
{
System.out.print(" ");
}
for ( k = 1; k <= x; k ++ )
{
System.out.print(" *");
}
System.out.println();
}
}
}
*
* * *
* * * * *
* * * * * * *
* * * * * * *
* * * * *
* * *
*
请大神解答!
天将明96
相关分类