
上QQ阅读APP看书,第一时间看更新
7. Pascal's triangle
Pascal's triangle is a triangle of numbers (you probably guessed that from its name) where each row begins and ends with 1 and every other value is the sum of the two numbers above it. The following diagram shows the first six rows of Pascal's triangle:
Write a program that displays Pascal's triangle as simple text. For a bigger challenge, display the values graphically centered over each other, as shown in the preceding figure.
The values in Pascal's triangle are binomial coefficients, where the K th value in row N is
. Here the rows and entries are numbered starting at zero. For example, the third entry in the fifth row has the value
=6.

