Java打印图案17
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
程序:
public class pattern4
{
public static void main(String[] args)
{
int n = 5;
for(int i = 0 ; i <= n ; i++)
{
for(int j = 0 ; j < i ; j++)
{
System.out.print(j+1);
}
System.out.println("");
}
}
}
输出:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5