package fibonacciseries; import java.util.Scanner; public class FibonacciSeries { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the size of the series: "); int size = input.nextInt(); int first = 0, second = 1, next; System.out.print(first + " " + second + " "); for (int i = 3; i <= size; i++) { next = first + second; System.out.print(next + " "); first = second; second = next; } } }