Urgent help needed

 DevX Home Today's Headlines   Articles Archive   Tip Bank   Forums

1. Registered User
Join Date
Nov 2004
Posts
2

## 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?

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

2. Registered User
Join Date
Nov 2004
Posts
2
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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 FAQ Latest Articles Java .NET XML Database Enterprise