About Me

My photo
Raipur, Chhattisgarh, India
Hi , I am Amit Thakur. I have worked as a QA Engineer for two years and as a Java Developer for one year in NIHILENT TECHNOLOGIES PVT. LTD., Pune.Currently I am working as DEAN (Research & Development) in Bhilai Institute of Technology, Raipur.

Monday, April 26, 2010

JAVA(Fibbonacci Series)--------------------------

//Fibbonacci Series


//Fibbonacci Series


import java.io.*;

class Fibbo

{

public static void main(String arr[])

{

int num=0,a=0,b=1,c=0;

System.out.println("Enter The Number of Elements in Series..");

try

{

DataInputStream dis=new DataInputStream(System.in);

num=Integer.parseInt(dis.readLine());

}

catch(Exception e){}

System.out.println("Fibbonacci Series is:- ");

System.out.print(" "+a);

System.out.print(" "+b);



for(int i=0;i

{

c=a+b;

System.out.print(" "+c);

a=b;

b=c;

}

}

}

No comments: