标题: 内嵌for循环打印三角形 [打印本页] 作者: cheukfan 时间: 2016-12-2 07:37 标题: 内嵌for循环打印三角形 public class LingXing
{
public static void main(String[] args)
{
int y = 0;
int z = 5;
String [] x = {""," "," "," "," "," "};
for (int a = 0; a < 5; a++)
{
z--;
System.out.print("\n"+x[z]);
for (int b = 0;b<=a; b++)
{
System.out.print(" *");
}
}
System.out.println();
for (int i = 0; i < 5; i++)
{