Fibonacci Series

Java Programming

Java Programming Examples

import java.io.*;

class fibonacci {
	public static void main(String args[ ]) {
		int start = 1, end = 0, temp = 0;
		System.out.println("Program for Fibonacci Series");

		/* Loop the process using 'do while' loop */
		do {
			System.out.println(temp);
			temp = start + end;
			start = end;
			end = temp;											
		}
		while(end < Integer.parseInt(args[0]));
	}
}


          /****** Output ******/
          

java fibonacci 50


Program for Fibonacci Series


0


1


1


2


3


5


8


13


21


34

Learn more about Fibonacci series