Saturday, August 7, 2010

Article | Fibonacci Series- Java Source Code

Java Source Code For Fibonacci Series



import java.io.*;

class Fibonaccis

{

public static void main(String args[])

{

int n=0,a=1,b=-1,sum=0;

System.out.print(" Enter The Limit For Fibonacci Series : ");

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

try

{

n=Integer.parseInt(br.readLine());

}catch(Exception e){}

System.out.println(" The Fibonacci Series Is As Follows Below ");

while(n>0)

{

sum=a+b;

System.out.print(sum+" , ");

b=a;

a=sum;

n--;

}

}

}

Loading...

Comments :

0 comments to “ Fibonacci Series- Java Source Code ”

Top Views

BloggerTipsTemplates

CHICKLETS

Enter your email address:

Delivered by FeedBurner

Followers