8.581
Bearbeitungen
Jneug (Diskussion | Beiträge) |
Jneug (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 12: | Zeile 12: | ||
Mathematisch ausgedrückt: | Mathematisch ausgedrückt: | ||
* <math> | * <math>f(n) = f(n-2)+f(n-1)</math> für <math>n>1</math> | ||
* <math> | * <math>f(n) = n</math> für <math>n<2</math> | ||
<syntaxhighlight lang="java" line="1" > | <syntaxhighlight lang="java" line="1" > | ||
public int | public int f(n) { | ||
if(n > 1) { | if(n > 1) { | ||
return | return f(n-2) + f(n-1); | ||
} else { | } else { | ||
return 1; | return 1; |
Bearbeitungen