0

```
import java.util.Scanner;
public class fibonacci{
public static void main(String[] args){
int n=0;
int fib = n+1;
Scanner X=new Scanner(System.in);
System.out.print("Enter # of the term: ");
n = X.nextInt();
for (int i=3; i<=n; i++)
{
i = i-1 + i-2;
}
System.out.print("Term is: "+n);
}
}
```

I know the algorithm is wrong, but I just can't seem to figure it out correctly.

I'm trying to construct the fibonacci algorithm without recursion and arrays.

If anyone could give me suggestions or pointers, it would be much appreciated.

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting