21 lines
409 B
Plaintext
21 lines
409 B
Plaintext
include "NSLog.incl"
|
|
NSLogSetTitle( @"Pascal's Triangle" )
|
|
NSLogSetTextAlignment( NSTextAlignmentCenter )
|
|
|
|
clear local fn pyramid( n as int )
|
|
int v( 20, 20 )
|
|
v( 0, 1 ) = 1
|
|
nslog( @"\n 1 " )
|
|
for int y = 1 to n -1
|
|
for int x = 1 to y + 1
|
|
v( y, x ) = v( y - 1, x - 1 ) + v( y - 1, x )
|
|
nslog( @"%4d \b", v( y, x ) )
|
|
next
|
|
nslog( @"" )
|
|
next
|
|
end fn
|
|
|
|
fn pyramid( 15 )
|
|
|
|
handleevents
|