Advertisement
apfel2kuchen

Untitled

Nov 20th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. program Fibonacci (input, output);
  2.  
  3. var
  4.  
  5. Fibonaccis : integer;
  6. i : integer;
  7.  
  8.  
  9. function FibonacciRek (inZahl : Integer): Integer;
  10. { berechnet die Fibonacci Zahl von inZahl >= 0 }
  11. begin
  12. if inZahl < 2 then
  13. FibonacciRek := inZahl
  14. else
  15. FibonacciRek := FibonacciRek (inZahl -1) + FibonacciRek (inzahl - 2);
  16. end;
  17.  
  18.  
  19.  
  20.  
  21.  
  22. begin
  23. writeln ('Geben Sie eine Zahl ein, von dieser wird die Fibonacci Zahl berechnet: ');
  24. read (Fibonaccis);
  25. writeln ('Die Fibonacci Zahl der Zahl: ', Fibonaccis, ' ist: ', FibonacciRek(Fibonaccis));
  26.  
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement