Anonymous user
Pascal's triangle: Difference between revisions
no edit summary
(Added Qi, translation of the last Haskell version) |
No edit summary |
||
Line 4:
1 2 1
1 3 3 1
The first element in each row is 1. Some people count it as zero, but it only makes since to have one as the first element
Write a function that prints out the first n rows of the triangle (with <tt>f(1)</tt> yielding the row consisting of only the element 1). This can be done either by summing elements from the previous rows or using a binary coefficient or combination function. Behavior for <tt>n <= 0</tt> does not need to be uniform, but should be noted.
|