23 lines
523 B
Haskell
23 lines
523 B
Haskell
-- Aufgabe: Implementiere die rekursive Fibonacci-Funktion mit Tail-Rekursion
|
|
|
|
fibonacciTail :: Integer -> Integer -> Integer -> Integer
|
|
-- TODO:
|
|
|
|
-- Testfälle
|
|
test1 = fibonacci 0 == 0
|
|
test2 = fibonacci 1 == 1
|
|
test3 = fibonacci 2 == 1
|
|
test4 = fibonacci 3 == 2
|
|
test5 = fibonacci 5 == 5
|
|
test6 = fibonacci 10 == 55
|
|
|
|
-- Hauptfunktion zum Testen
|
|
main :: IO ()
|
|
main = do
|
|
putStrLn "Teste fibonacci-Funktion mit Tail-Rekursion..."
|
|
print test1
|
|
print test2
|
|
print test3
|
|
print test4
|
|
print test5
|
|
print test6 |