In this article we are going to learn how to make Fibonacci series in JAVA step by step...
Below is my code:
class fibonacci
{
public static void main(String s[])
{
int a,b=0,c=1,d;
System.out.print(""+b);
System.out.print(","+c);
for(a=1;a<=50;a++)
{
d=b+c;
b=c;
c=d;
System.out.print(","+d);
}
}
}
Step 1: After writing this in notepad save the file
with the name followed by (.java) for
eg.i saved it with fibonacci.java
Step 2 : Open command prompt.
Step 3 : Write javac
fibonacci.java - Press Enter for compilation.
Step 4 : Write java
fibonacci for execution
Now Output:

Image 1.