package star;
public class pyramidnum {
public static void main(String[] args) {
for (int i = 1; i <= 4; i++)
{
for (int j = 4; j > i; j--)
{
System.out.print(" ");
}
for (int j = i; j > 1; j--)
{
System.out.print(j + " ");
}
for (int j = 1; j <= i; j++)
{
System.out.print(j + " ");
}
System.out.println();
}
}
}
public class pyramidnum {
public static void main(String[] args) {
for (int i = 1; i <= 4; i++)
{
for (int j = 4; j > i; j--)
{
System.out.print(" ");
}
for (int j = i; j > 1; j--)
{
System.out.print(j + " ");
}
for (int j = 1; j <= i; j++)
{
System.out.print(j + " ");
}
System.out.println();
}
}
}
No comments:
Post a Comment