I was trying to print the Fibonacci series without using recursion.
Here is my code:
public static void fibonacci(int number) {
int fibo1 = 1;
int fibo2 = 1;
System.out.printf("%nFibonacci series of %d numbers are : ", number);
System.out.printf("%s ", fibo1);
System.out.printf("%s ", fibo2);
for (int i = 2; i < number; i) {
int fibonacci = fibo1 + fibo2
System.out.printf("%s ", fibonacci);
fibo2 = fibo1;
fibo1 = fibonacci;
}
}
but, somehow this code is not working. can you help me where I went wrong?
I was referring to this article for my knowledge.