用* 等腰三角形
package javastudy;
import java.util.*; //引用import.java.util.*; Scanner类在这里面
import java.lang.Integer; //引用import.java.lang.Integer 使用Integer.parseInt()
public class Isosceles {
public static void main(String[] args) {
// TODO Auto-generated method stub
int i,j,g; //i为行数,j为列数,g为输入行数
//k=i-j;
System.out.println("请输入一个数字:");
Scanner s=new Scanner(System.in);
String h=s.next();
g=Integer.parseInt(h);
System.out.println(g);
s.close(); //记得关闭
for(i=1;i<=g;i++){
for(j=1;j<=(2*g+1);j++){
if(j<=g-i||j>g+i-1)
System.out.print(" ");
else
System.out.print("*");
/*else if(j==2*g-1)
System.out.println(" ");*/
}
System.out.println();
}
}
}