DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004

    Unhappy 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

    Thanks a Billion in advance!

    PS: I got saddled with the worst, least helpful teacher here...!

  2. #2
    Join Date
    Nov 2004
    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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.