// Program to test recursion, printing Pascal's triangle program var comb = funct( n, r ) begin if r < 0 or r > n then return 0; elif r == 0 or r == n then return 1; else return comb( n - 1, r - 1 ) + comb( n - 1, r ); end end, pad = funct( n, padlen ) var s, length; begin s = "" + n; while size s < padlen do s = " " + s; end return s; end, n, r; begin for n = 0; n < 10; n = n + 1 do for r = 0; r < 10 - n; r = r + 1 do print( " " ); end for r = 0; r <= n; r = r + 1 do print( pad( comb( n, r ), 8 ) ); end println(); end end.