Fibonacci Series in Java
Compile and Run the following code with Command-Prompt Or download Notepad++
For Compilation javac Sample.java
For Execution java Sample
import java.util.Scanner; class Sample { public static void main(String args[]) { int first_no = 0,second_no = 1,result; int a; int count = 0; Scanner sc = new Scanner(System.in); System.out.println("Enetr the number: "); a = sc.nextInt(); while(true) { result = first_no + second_no; second_no = result; System.out.println("\n"+result); } } }