Pascal Triangle

The following code sample shows how to create pascaltriangle

using System;
using System.Collections.Generic;

class PascalTriangle
static void Main()
foreach (uint[] row in GetPascalTriangle())

static void Print(uint[] row)
foreach (uint e in row)
Console.Write(“{0}\t”, e);

static IEnumerable GetPascalTriangle()
uint[] row = new uint[1] { 1 };

for(int n = 2; ; n++)
yield return row;

uint[] nrow = new uint[n];
Array.Copy(row, nrow, n-1);
for (int i = 1; i < n; i++)
nrow[i] += row[i-1];
row = nrow;


About Asif
Hello Friends… I have done my Bachelor of Engineering in Information Technology from Gujarat University. I have 1.7 years experience of web and windows based application development.. My basic idea to start a blog is to store all important link which help me in my application and access to every where. Also this information is help others who want to makes their application powerful. I am interested in .net framework (1.0,2.0,3.0,3.5 and more). This blog contain also many information related to SQL, Custom Controls in Please share your ideas and any query if you have...

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: