Fibonacci Series in Java

Table of Contents

Fibonacci Series in Java

Compile and Run the following code with Command-Prompt Or download Notepad++

For Compilation javac

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.out.println("Enetr the number: ");
  a = sc.nextInt();
    result = first_no + second_no;
    second_no = result;
Previous Swap Logic 2 in Java
Next Palindrome in Java

Leave a Reply