
Nov 2nd, 2011, 03:50 PM
#1
Thread Starter
New Member
VB 2010  Need help
I need to create an application that creates Pascal's triangle
the user would enter the number of rows, and using the formula (which i do not know... :/) would create the triangle. For example: the user enters 5 rows
triangle:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
as you can see the numbers are created by adding the 2 numbers above it starting with 1 at the top

Nov 2nd, 2011, 04:09 PM
#2
Re: VB 2010  Need help
In order to make an application, you need to understand the logic of it. I guess you need to go and find out what the formula is first.

Nov 2nd, 2011, 04:11 PM
#3
Thread Starter
New Member
Re: VB 2010  Need help
you learn it in grade 11 math, which i have next semester...

Nov 2nd, 2011, 04:25 PM
#4
Re: VB 2010  Need help
If you searched this forum for "pascal's triangle", you would've have found this thread:
http://www.vbforums.com/showthread.php?t=655198
I wrote some functions to generate the Pascal's triangle not too long ago, and when I saw your question, I knew immediately it has been solved before
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
 Abraham Lincoln 

Nov 2nd, 2011, 04:31 PM
#5
Thread Starter
New Member

Nov 2nd, 2011, 05:57 PM
#6
Junior Member
Re: VB 2010  Need help
At the tip of Pascal's Triangle is the number 1, which makes up the zeroth row. The first row (1 & 1) contains two 1's, both formed by adding the two numbers above them to the left and the right, in this case 1 and 0 (all numbers outside the Triangle are 0's). Do the same to create the 2nd row: 0+1=1; 1+1=2; 1+0=1. And the third: 0+1=1; 1+2=3; 2+1=3; 1+0=1. In this way, the rows of the triangle go on infinitly. A number in the triangle can also be found by nCr (n Choose r) where n is the number of the row and r is the element in that row. For example, in row 3, 1 is the zeroth element, 3 is element number 1, the next three is the 2nd element, and the last 1 is the 3rd element. The formula for nCr is:
n!

r!(nr)!
Does this help?

Nov 2nd, 2011, 08:02 PM
#7
Re: VB 2010  Need help
The formula that creates the triangle is 11 ^ (row number  1)... isn't it? With a BigInteger you could calculate any row.
Tags for this Thread
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
