# java code for fibonacci series?

• December 31st, 2011, 02:12 PM
javawreker
java code for fibonacci series?
i am new to java..

can someone help me with a program that displays fibonacci series ..when limit is mentioned ?
• December 31st, 2011, 02:15 PM
newbie
Re: java code for fibonacci series?
Yeah we can, but first you need to show us what you've done so far and what problems you're having.
• December 31st, 2011, 03:25 PM
Norm
Re: java code for fibonacci series?
Is this the same problem that you posted on another forum?
• January 1st, 2012, 02:08 AM
javawreker
Re: java code for fibonacci series?
this is fibonacci.. the other was factorial..lol ..infact i have a total of 18 problems to solve and study..i was wondering where i could ask about all these..

Quote:

import java.io.*;
class fibonacci
{
int first,second,third,lim;
string n1;

System.out.println("\n enter the limit");

lim = Integer.parseInt(n1);

first=0;
second =1;

for (int i = 1; i<=lim; i++)
{

System.out.println(first);

third=first +second;
first = second;
second= third;

}
}
}

• January 1st, 2012, 05:54 AM
Norm
Re: java code for fibonacci series?
Can you post the program's output and explain what is wrong with it?
• January 1st, 2012, 06:39 AM
javawreker
Re: java code for fibonacci series?
thats not what i am worried about.. i cant make sense of the logics behind these.. all i could do is byheart these codes for the exam.. speaking about these helps me a bit...

i have a palindrome problem.. a problem to find the area of a circle using interface... i dont even know what an interface is..

is it ok to post the rest of the problems here ?
i might be able to correct atleast syntax errors by having a little discussion about it
• January 1st, 2012, 07:02 AM
Norm
Re: java code for fibonacci series?
Work on one problem at a time.
What happens when you compile and execute the code you posted in post#4?