answersLogoWhite

0


Best Answer

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

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Pascal's triangle using q-basic
Write your answer...
Submit
Still have questions?
magnify glass
imp
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 :)


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 do you write a name using do while loop on QBASIC?

QBasic is a type of question basic 🤗🤗🤗🤗😅😂🤣😁😛


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

pascals theory


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)


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

Using TurboC? kbhit and getch are your friends


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.


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