Thread: Fibonnaci Sequence

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    28

    Fibonnaci Sequence

    Code:
    int main()
    {
    int n;
      int* fib;
      printf("\nFibonacci test 1: enter an integer\n");
      scanf("%d",&n);
      fib = fibonacci(n);
      printf("fib(%d) = ", n);
      for(int i = 0; i < n; ++i){
             printf("%d ", fib[i]);
      }
    What should I do/write for the fibonnaci function
    Code:
    int fibonnaci(int size)
    {....
    ....}

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by AFCKING View Post
    What should I do/write for the fibonnaci function
    seriously, what you need to do is stop treating the members of this forum like your personal search engine. learn to use google. there are literally thousands of code examples of how to do the fibonacci series in C. if this exercise is for a class, then the instructor certainly gave you instructions on how to do it.

  3. #3
    Registered User
    Join Date
    Jan 2013
    Posts
    28
    I asked what should I do as in give me some pointers so I could do them myself, right now I don't know where to start, what is the point of having forums to ask if you already have google. Google just gave you the answers and I want to know how to do it, there's a difference.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    do you understand what the fibonacci sequence is? how to calculate it?

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    I asked what should I do as in give me some pointers so I could do them myself, right now I don't know where to start...
    Writing a program is essentially writing a set of instructions for the computer.

    This means that if you cannot work something out competently by hand, it is not possible to write a program to do that task.

    Step 1: Understand the problem you have to solve. Work out examples, on paper, to get a feeling of how to solve it.

    Step 2: Now that you know how to solve it, you then have to determine how you're going to get the computer to do it for you. Go through some examples again, still on paper, but this time around, break it down into the smallest possible steps. Keep track of each step you take to solve the problem. This will serve as an outline for the program you will write.

    Step 3: Now that you understand the problem, and have a list of steps written down to solve it, you can start writing code. But break it down into smaller steps - don't try to write all the code at once. Start simple - write a bit of code, compile, fix any warnings/errors, and make sure it does what it's supposed to. Then add a bit more code, compile, etc. Repeat until you're done. (See A Development Process for a more illustrative example.)

    During this process, if there's something you can't figure out, come back, show your code, and ask specific questions. Following this process will ensure that; (1) You'll get a better grasp of writing programs, and (2) You'll get more helpful responses when asking for help on the forum.

  6. #6
    Registered User
    Join Date
    Dec 2012
    Posts
    307
    seems to me after seeing all this, that someone doesnt know jack, including how to listen to his instructor or use google.....

    Can any tell me what is wrong with this? Started by AFCKING, 5 Hours Ago 02:38 PM
    Fibonnaci Sequence Started by AFCKING, 3 Hours Ago 04:06 PM
    Help! Started by AFCKING, 4 Hours Ago 03:18 PM
    Assignments help Started by AFCKING, 6 Hours Ago 01:57 PM

  7. #7
    Registered User hex_dump's Avatar
    Join Date
    Dec 2012
    Posts
    88
    The language is there for you to solve the problem. However you have to first understand the problem, then solve it using the language. Whether it be C, C++ or Python or what not. Google "Fibonnaci Squence" algorithm for example and/starters, write out how you would solve it in plain english, then write out that same solution in C. Once you have that you can post on here and someone will be happy to help out.

  8. #8
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by AFCKING View Post
    right now I don't know where to start
    In my experience, that is always bollucks. All it really means is that the complete lack of knowledge means that actually taking the time to learn seems so overwhelming that the person just can't be bothered. I.e. it's just laziness.

    You can always use a search engine, and you can always write something, even if it's just declaring a few variables and giving them values.
    Now get off your butt and make a start!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fibonnaci question...
    By ssjnamek in forum C++ Programming
    Replies: 4
    Last Post: 05-11-2011, 04:26 AM
  2. % sequence
    By goran00 in forum C Programming
    Replies: 9
    Last Post: 01-28-2008, 04:48 PM
  3. Binary Sequence
    By royshh in forum C++ Programming
    Replies: 3
    Last Post: 03-31-2006, 02:56 PM
  4. sequence
    By braddy in forum C Programming
    Replies: 2
    Last Post: 03-30-2006, 02:15 PM
  5. sequence
    By Space_Cowboy in forum C++ Programming
    Replies: 1
    Last Post: 12-08-2002, 06:54 PM