Source file pascal.icn
############################################################################
#
#	File:     pascal.icn
#
#	Subject:  Procedure to write Pascal triangles
#
#	Author:   Ralph E. Griswold
#
#	Date:     August 3, 2000
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#  This procedure writes numeric triangles as "carpets".
#
#  The argument determines the number of rows written, default 16.
#
############################################################################
#
#  Requires:  large integers
#
############################################################################
#
#  Links:  math
#
############################################################################

link math

#  The Pascal Triangle

procedure pascal(n)		#: Pascal triangle
   local i, j

   /n := 16

   write("width=", n, " height=", n)	# carpet header

   every i := 0 to n - 1 do {
      every j := 0 to n - 1 do
         writes(binocoef(i, j) | 0, " ")
      write()
      }

end

This page produced by UniDoc on 2021/04/15 @ 23:59:45.