Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: java code for fibonacci series?

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

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


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default 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.
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java code for fibonacci series?

    Is this the same problem that you posted on another forum?
    some code explanation please?
    Please provide a link to the other forum so people here can see what has been answered already for this question.

  4. The Following User Says Thank You to Norm For This Useful Post:

    newbie (December 31st, 2011)

  5. #4
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

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



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

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

    BufferedReader in = new BufferedReader (new InputStreamReader(System.in));

    n1 = in.readLine();

    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;



    }
    }
    }












    Last edited by javawreker; January 1st, 2012 at 03:28 AM.

  6. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java code for fibonacci series?

    Can you post the program's output and explain what is wrong with it?

  7. #6
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

  8. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

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

Similar Threads

  1. Fibonacci series
    By seanman in forum Algorithms & Recursion
    Replies: 4
    Last Post: September 11th, 2011, 12:32 PM
  2. Java applet for Fibonacci grid
    By jnapoles in forum Java Applets
    Replies: 1
    Last Post: January 27th, 2011, 01:56 AM
  3. problem to get Fibonacci series- please help.
    By zoala001 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 3rd, 2011, 01:10 AM
  4. Fibonacci Spiral Help?
    By cmh0114 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 12th, 2010, 09:21 PM
  5. Replies: 1
    Last Post: October 19th, 2009, 11:53 PM