C# Program to display the pascal’s triangle

This is a C# program to print the pascal’s triangle. This program uses the for loops to print the Pascal’s triangle. Before we move on to the program, let us learn what a Pascal’s triangle really is.
Pascal’s triangle from Wikipedia:

In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients in a triangle. It is named after the French mathematician, Blaise Pascal. It is known as Pascal’s triangle in much of the Western world, although other mathematicians studied it centuries before him in India, Persia, China, Germany, and Italy.

The rows of Pascal’s triangle are conventionally enumerated starting with row n = 0 at the top. The entries in each row are numbered from the left beginning with k = 0 and are usually staggered relative to the numbers in the adjacent rows. A simple construction of the triangle proceeds in the following manner. On row 0, write only the number 1. Then, to construct the elements of following rows, add the number directly above and to the left with the number directly above and to the right to find the new value. If either the number to the right or left is not present, substitute a zero in its place. For example, the first number in the first row is 0 + 1 = 1, whereas the numbers 1 and 3 in the third row are added to produce the number 4 in the fourth row

Program:

Output

The following two tabs change content below.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">