home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
procs
/
pascal.icn
< prev
next >
Wrap
Text File
|
2000-08-03
|
1KB
|
49 lines
############################################################################
#
# 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