# Urgent help needed

• 11-16-2004, 08:00 PM
saxydrewski
URGENT Help Needed fast :(
Can anyone here please tell me how to make a java program on JBuilder that lets you put a number in between 1 and 20 and gives you the fibonacci number?:confused:

We are supposed to have it print out like "Fibonacci(14) is 377.

I have the input ok, and the output, but I do not know how to use a "While" loop to compute the fib number.:(

My teacher and tutor are both unable to help me, and if I want to pass this class, I only need this final assignment to be passing (we have no final :))!

Anyone who can help me with how to use a while loop to compute a fibonacci number i would appreciate it.. all they have online for source codes are fibonacci series' (i just need the one number at a time computed) and stuff, and its all too advanced for my class (Comp Sci 100) so he would know I had help and fail me.

for those who dont remember, fibonacci is...

0 1 1 2 3 5 8 13 21 etc

• 11-16-2004, 10:30 PM
saxydrewski
to clarify, what i need is something i believe goes like this? do you have any idea what I need? lol

int num ;

int first;
first = 0;
int second;
second = 1;

num = readint.ln(what is the number, between 1 - 20?)

while (counter < fib)

first + second = fib

second = first
fib = second

counter = counter + 1