How to Create a Program to Print Fibonacci Series in Core Java

In this tutorial how to create a program to print Fibonacci Series  in Core Java  is shown.

Code:

Fibonacci.java

class Series
{
public static void main(String args[])
{
int fibbo=1,f1=0,f2=1;
System.out.print(“0″);
for(int i=0;i<10;i++)
{
System.out.print(” “+fibbo);
fibbo=f1+f2;
f1=f2;
f2=fibbo;
}
}
}

Add a Comment

Your email address will not be published. Required fields are marked *