package demo;
public class ZeroPyramid
{
public static void main(String[] args)
{
System.out.println("1");
for (int r = 2; r <= 8; r++)
{
for (int c = 1; c <= r; c++)
{
if (c == r) {
System.out.print(r);
} else {
System.out.print("0");
}
}
System.out.println();
}
}
}
Output:
1
02
003
0004
00005
000006
0000007
00000008
BUILD SUCCESSFUL (total time: 0 seconds)
No comments:
Post a Comment