Print first N numbres of the Fibonacci sequence

public void Fibonacci(int n) { int fibo1 = 1; int fibo2 = 1; System.out.print(fibo1 + " "); for (int i = 2; i <= n; i++) { System.out.print(fibo2 + " "); fibo2 = fibo1 + fibo2; fibo1 = fibo2 - fibo1; } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.