answersLogoWhite

0

You could just use the binomial theorem. Step through rows, n, and entries, k, and compute the Pascal's triangle value as

n!/(k!*(n-k)!)

You'll actually have better luck if you use the natural log of a factorial, then you can use laws of exponents to get:

exp(log(n!/k!/(n-k)!))

= exp(log(n!)-log(k!)-log((n-k)!))

= exp(logfact(n)-logfact(k)-logfact(n-k))

which won't run into the integer overflow problems that a plain factorial function would have.

To fill up a logfact array, something like this might work:

while(i<maxn)

logfact(i)=logfact(i-1)+log(i)

i=i+1

Wend

Be careful to initialize correctly, and watch your conversion between integers and doubles (probably have to do some rounding to your final answers).

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What is the answer to 7C3 using pascals triangle?

35


Write a program in qbasic to make a hut using print statemant?

a triangle then a square :)


How do you fill a triangle in qbasic graphics?

In QBasic graphics, you can fill a triangle using the PUT statement along with the LINE statement to draw the triangle's outline, and then use the FILL statement to fill the interior. First, define the triangle's vertices by specifying their coordinates, then use LINE to connect these points. After outlining the triangle, you can use the FILL statement to fill it with a specified color. Make sure you have the graphics mode set up properly using SCREEN before drawing.


How do you color triangle in qbasic?

In QBasic, you can color a triangle using the LINE statement to draw the triangle's sides and the PAINT statement to fill it with color. First, use LINE to specify the coordinates of the triangle's vertices. Then, use PAINT at one of the triangle's vertices with the desired fill color. For example: LINE (x1, y1)-(x2, y2), color LINE (x2, y2)-(x3, y3), color LINE (x3, y3)-(x1, y1), color PAINT (x1, y1), fillColor Replace (x1, y1), (x2, y2), (x3, y3) with the triangle's coordinates and color and fillColor with your chosen colors.


What is the answer to 10c3 using pascals triangle?

To find (10C3) using Pascal's Triangle, locate the row corresponding to (n=10). The entries in this row represent the binomial coefficients for (n=10). The third entry (starting from (0)) in this row corresponds to (10C3), which is (120). Thus, (10C3 = 120).


What is the sum of the 100th row of pascals triangle?

Sum of numbers in a nth row can be determined using the formula 2^n. For the 100th row, the sum of numbers is found to be 2^100=1.2676506x10^30.


To print even nobetween 10 and 100 on qbasic command?

You need a code that can run to print even numbers between 10 and 100 using the qbasic command.


How can I convert millimeters of mercury (mmHg) to pascals (Pa) using a converter tool?

To convert millimeters of mercury (mmHg) to pascals (Pa) using a converter tool, simply enter the value in millimeters of mercury into the converter tool and it will automatically calculate the equivalent value in pascals for you.


How do you start QBASIC in windows Vista?

To start QBASIC in Windows Vista, first, ensure you have the QBASIC executable file (QBASIC.EXE) available on your computer. Open the Start menu, select &quot;Computer,&quot; and navigate to the folder where QBASIC.EXE is located. You can run QBASIC by double-clicking the executable file or by opening the Command Prompt, navigating to the folder using the &quot;cd&quot; command, and typing &quot;QBASIC&quot; to launch the program. If you encounter issues, consider running it in compatibility mode for older versions of Windows.


What is a mathematical statement that can be shown to be true by using previous statements?

pascals theory


What is the sum of the 17th row of pascals triangle?

The sum of the 17th row of Pascal's Triangle can be calculated using the formula 2^n, where n is the row number minus one. In this case, the 17th row corresponds to n=16. Therefore, the sum of the 17th row is 2^16, which equals 65,536.


How do you display qBasic programming if their is no MS-DOS prompt?

If you are using windows, MSDOS shell is integrated by default..


How do you do a nested loop using Qbasic?

There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.


How is water pressured be measure?

Using a water pressure gauge and is measured in kilo pascals (kpa)


How can you use the pattern in the table of combinations to find a number in pascals triangle?

To find a number in Pascal's Triangle using combinations, you can use the formula (C(n, k) = \frac{n!}{k!(n-k)!}), where (n) is the row number and (k) is the position in that row. Each number in Pascal's Triangle corresponds to a combination, where the top of the triangle represents (C(0, 0)), the next row (C(1, 0)) and (C(1, 1)), and so on. By identifying the desired row and position, you can apply the combinations formula to calculate the specific number in Pascal's Triangle.


Is there any keyword in c or c plus plus like the function inkey in qbasic?

Using TurboC? kbhit and getch are your friends


Is there a way to predict the next line in pascals triangle?

Yes, the next line in Pascal's Triangle can be predicted using the coefficients of the binomial expansion. Each element in a new row is the sum of the two numbers directly above it from the previous row. For example, if the last completed row is [1, 3, 3, 1], the next row can be calculated as [1, 4, 6, 4, 1] by summing adjacent pairs. Thus, the structure of Pascal's Triangle allows for straightforward prediction of subsequent rows.


Alculate the pressure in pascals if a 140N force is applied to an area of 0.1m .?

The pressure can be calculated using the formula: pressure = force / area. Plugging in the values given, the pressure in pascals would be 140N / 0.1m^2 = 1400 Pa.


Given the sides of a triangle how do you find the height?

By using sides we get area of triangle and then using (1/2)heightxbase we get height.


How do you find the perimeter of a right angled triangle using the area?

how to find the perimeter of a right angled triangle using the area