Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Function factorial(n As Integer) As Integer
|
||||
If n < 1 Then Return 1
|
||||
Dim product As Integer = 1
|
||||
For i As Integer = 2 To n
|
||||
product *= i
|
||||
Next
|
||||
Return Product
|
||||
End Function
|
||||
|
||||
Function binomial(n As Integer, k As Integer) As Integer
|
||||
If n < 0 OrElse k < 0 OrElse n <= k Then Return 1
|
||||
Dim product As Integer = 1
|
||||
For i As Integer = n - k + 1 To n
|
||||
Product *= i
|
||||
Next
|
||||
Return product \ factorial(k)
|
||||
End Function
|
||||
|
||||
For n As Integer = 0 To 14
|
||||
For k As Integer = 0 To n
|
||||
Print Using "####"; binomial(n, k);
|
||||
Print" ";
|
||||
Next k
|
||||
Print
|
||||
Next n
|
||||
|
||||
Print
|
||||
Print "Press any key to quit"
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue