
/**
 * Title:        Chapter 3, "Control Statements"
 * Description:  Chapter 3 Examples
 * Copyright:    Copyright (c) 2000
 * Company:      Armstrong Atlantic State University
 * @author Y. Daniel Liang
 * @version 1.0
 */

// PrintPyramid.java: Print a pyramid of numbers
package chapter3;

public class PrintPyramid
{
  /**Main method*/
  public static void main(String[] args)
  {
    for (int row = 1; row < 6; row++)
    {
      // Print leading spaces
      for (int column = 1; column < 6 - row; column++)
        System.out.print(" ");

      // Print leading numbers
      for (int num = row; num >= 1; num--)
        System.out.print(num);

      // Print ending numbers
      for (int num = 2; num <= row; num++)
        System.out.print(num);

      // Start a new line
      System.out.println();
    }
  }
}