Fibonacci Series

in Hindi - Fibonacci Series



not yet

Source Code :

RUNimport java.util.Scanner;

public class Fibonacci
{
public static void main(String args[])
{ 
int n, i, first = 0, second = 1, next;

System.out.println("Enter the number of terms");
Scanner enter = new Scanner(System.in);
n = enter.nextInt();

System.out.println("Fibonacci series are");
for (i = 0 ; i < n ; i++)
{
if (i <= 1)
next = i;
else
{
next = first + second;
first = second;
second = next;
}
System.out.println(next);
}

}
}