0

Hello,

I have a to make a class called fibonacci. This is what is given to us :

fibonacci(0)=1

fibonacci(1)=1

fibonacci(n)= fibonacci(n-1)+fibonacci(n–2)

Below is an example of running the fibonacci class as an input of 6. The output is:

fibo(0)=1

fibo(1)=1

fibo(2)=2

fibo(3)=3

fibo(4)=5

fibo(5)=8

fibo(6)=13

**My code is:**

```
import java.util.*;
public class Fibonacci {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter the size of the fibonacci series: ");
int num = s.nextInt();
int a=0,b=0,c=1;
for(int i=1;i<=num;i++){
System.out.println(c);
a=b;
b=c;
c=a+b;
}
}
}
```

**My output is:**

Enter the size of the fibonacci series:

6

1

1

2

3

5

8

**Why is my answer not matching his? Is there something that I am doing wrong?**

Thanks for your help.