Java program for fibonacci series - Code

Latest

programs

Monday, October 10, 2011

Java program for fibonacci series


import java.io.*;
import java.lang.*;
class fibonacci
{
public static void main(String args[]) throws IOException
{


int n=Integer.parseInt(args[0]);
int a=0,b=1,c,i=0;
while(i<n)
{
c=a+b;
System.out.println(c);
a=b;
b=c;
i++;
}
}
}

No comments:

Post a Comment