public class FibonacciDemo {
public static void main(String[] args) {
int count, num1=0, num2=1;
System.out.println("How many numbers you want in the sequence: ");
Scanner yash = new Scanner(System.in);
count = yash.nextInt();
System.out.println("Fibonacci series of " + count + " number:");
int i=0;
while(i<=count){ // 0<= 5,1<=5 , 2<=5
System.out.println(num1+" "); // 0
int aman = num1 + num2; // 0 + 1 = 1, 1 + 1=2
num1 = num2; //num1 = 1, num1 =1
num2 = aman; // num2=1, num2= 2
i++; // 0+1 = 1, 1+1 =2
}
}
}