DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    2

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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links