Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rekursiv definition:
- N! = N*(N-1)!
- N fakultet
- 3!=1*2*3=6 etc
- 0!=1
- N!=N*(N-1)!
- 4=4* 4-1= 24
- 1 om N=0
- N!
- Res: Integer;N: Integer;begin
- Get(N); N:3Res:= Factorial(N)/6;
- Put (Res);
- ------------------------------------
- UP
- Function Factorial( N :in Integer) (-är ej samma N som tidigare)
- Return integer is
- Begin
- If N=0 then
- Return 1;
- else
- Return N* Factorial(N-1);
- End if;
- End Factorial;
- -----------------------------------
- function Factorial2( : in Integer) return Integer is
- begin
- if N = 0 then
- return 1
- else
- return N*Factorial(N-1);
- end if;
- end Factorial2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement