Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- n: integer;
- function fib(n: integer): integer;
- begin
- if n=1 then
- fib:=1
- else if n=2 then
- fib:=1
- else
- begin
- fib:=fib(n-1) + fib(n-2);
- end;
- end;
- begin
- write('Введите число N: ');
- readln(n);
- write('N-ное число Фибоначчи равно: ', fib(n));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement