Skip to content
Home
Post Code
Jass (Warcraft III)
Wurst
GUI (Warcraft III)
Galaxy (StarCraft II)
GUI (StarCraft II)
C++
Java
Delphi
Text
Search Code
Compare Code
Uploads
Draw
Create New Drawing
View Drawings
Graph
Log in
/
**
*
* Beschreibung
* Gibt Fibonacci Reihe bis
100
aus
* @version
1
.
0
vom
02
.
03
.
2012
*
/
public
class
fibonacci
{
public static void main(String[] args)
{
System.out.println("Hier sehen sie die Fibonacci-Reihe von 1-100:");
for (int n=1;n<=11;n++)
{
System.out.println(fibonacci(n));
}
}
static int fibonacci(int n)
{
if (n<=2)
{
return 1;
}
else
{
return fibonacci(n-1)+fibonacci(n-2);
}
}
}
select language
jass
java
> delphi
C++
php
GSL
galaxy
visualBasic
wurst
Text
Markdown
select style
default
bbcode - default
Jasscraft
jasscraft html
visual
lightweight
> lightweightNr
goto line:
Compare with:
text copy window
edit this code
post new code
/** * * Beschreibung * Gibt Fibonacci Reihe bis 100 aus * @version 1.0 vom 02.03.2012 */ public class fibonacci { public static void main(String[] args) { System.out.println("Hier sehen sie die Fibonacci-Reihe von 1-100:"); for (int n=1;n<=11;n++) { System.out.println(fibonacci(n)); } } static int fibonacci(int n) { if (n<=2) { return 1; } else { return fibonacci(n-1)+fibonacci(n-2); } } }