Fibonacci Series

A series in which next number is the sum of previous two numbers are called fibonacci series.

For Example:  0, 1, 1, 2, 3, 5, 8, 13, 21, 34... 

Print the fibonacci series upto 8 digit.


	public class Fibonacci {
	    public static void main(String[] args) {
	
	        int count = 8, num1 = 0, num2 = 1;
	        System.out.print("Fibonacci Series of "+count+" numbers:");
	
	        for (int i = 1; i <= count; ++i)
	        {
	            System.out.print("Print number "+num1);
	 			int sumOfNum1Num2 = num1 + num2;  // Add num1 and num2
	            num1 = num2;   //store  num2 in num1 
	            num2 = sumOfPrevTwo; // assign the sum of Num1 and Num2,  
	        }
	    }
	}
					
Output:  0, 1, 1, 2, 3, 5, 8, 13, 21, 34...