how can i write a program in GW-BASIC to calculate and print following formula using user-defined function

"combination=n!?k!*(n-k)"

What is meant by "user-defined function"? Do you mean user input? Please define this using known math symbols "n!?k!". I do not know what a ? is mathematically.

As far as doing factorials in basic you do them like...

' Initialize the variables

Dim counter As Integer : counter = 5

Dim factorial As Long : factorial = 1

Do While counter > 0

factorial = factorial * counter ' Multiply

counter = counter - 1 ' Decrement

Loop

Print factorial ' Prints out the result.

Ask Your Question

Weekly Poll

Would you ride in a self-driving car from Tesla?

Discuss in The Lounge

Poll History