Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -0,0 +1,22 @@
|
|||
110 FOR N = 0 TO 14
|
||||
120 FOR K = 0 TO N
|
||||
130 GOSUB 500 ' Call to binomial
|
||||
140 PRINT USING " ####"; B;
|
||||
150 NEXT K
|
||||
160 PRINT
|
||||
170 NEXT N
|
||||
180 END
|
||||
|
||||
500 ' Binomial subroutine
|
||||
510 ' Input: N, K
|
||||
520 ' Output: B (result of binomial)
|
||||
530 IF K = 0 OR K = N THEN B = 1: RETURN
|
||||
540 IF K < 0 OR K > N THEN B = 0: RETURN
|
||||
550 ' For efficiency, we use the lowest value of K or (N-K)
|
||||
560 IF K > N-K THEN K1=N-K ELSE K1=K
|
||||
570 PR = 1
|
||||
580 FOR I = 1 TO K1
|
||||
590 PR = PR * (N-K1+I)/I
|
||||
600 NEXT I
|
||||
610 B = INT(PR + 0.5)
|
||||
620 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue