Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Lah-numbers/XPL0/lah-numbers.xpl0
Normal file
31
Task/Lah-numbers/XPL0/lah-numbers.xpl0
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
func real Factorial(N);
|
||||
real N, Res;
|
||||
[Res:= 1.;
|
||||
if N = 0. then return Res;
|
||||
while N > 0. do [Res:= Res*N; N:= N-1.];
|
||||
return Res;
|
||||
];
|
||||
|
||||
func real Lah(N, K);
|
||||
real N, K;
|
||||
[if K = 1. then return Factorial(N);
|
||||
if K = N then return 1.;
|
||||
if K > N then return 0.;
|
||||
if K < 1. or N < 1. then return 0.;
|
||||
return (Factorial(N) * Factorial(N-1.)) / (Factorial(K) * Factorial(K-1.)) /
|
||||
Factorial(N-K);
|
||||
];
|
||||
|
||||
int Row, I;
|
||||
[Text(0, "Unsigned Lah numbers: L(N,K):"); CrLf(0);
|
||||
Text(0, "N/K");
|
||||
Format(11, 0);
|
||||
for I:= 0 to 12 do RlOut(0, float(I));
|
||||
CrLf(0);
|
||||
for Row:= 0 to 12 do
|
||||
[Format(3, 0); RlOut(0, float(Row));
|
||||
for I:= 0 to Row do
|
||||
[Format(11, 0); RlOut(0, Lah(float(Row), float(I)))];
|
||||
CrLf(0);
|
||||
]
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue