+ 2
Fibonacci
Hey! I've made a program that returns the fibonacci's sequence, but I would like to improve it's performance. Does anyone know a simple way to do this using OOP in java?
4 odpowiedzi
+ 3
You just want to output them?
int x = 1, y = 1;
System.out.print(x + ", " + y );
for(int i = 0; i < 20; i++){
y = x + y;
x = y - x;
System.out.print(", " + y );
}
+ 1
Might help to use this? http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.html
0
OOP*
In my language the order is different, hehehehe
- 1
POO?