+ 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?

20th Feb 2017, 3:07 PM
Guilherme Pereira
Guilherme Pereira - avatar
4 Antworten
+ 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 ); }
20th Feb 2017, 4:23 PM
Robobrine
Robobrine - avatar
21st Feb 2017, 8:57 AM
मानस
0
OOP* In my language the order is different, hehehehe
20th Feb 2017, 3:13 PM
Guilherme Pereira
Guilherme Pereira - avatar
- 1
POO?
20th Feb 2017, 3:11 PM
Liam Keegan
Liam Keegan - avatar