Thread: Fibonacci using Recursion

  1. #16
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Quote Originally Posted by jazzistoobad
    (...) were suppose to do a program to gnerate a fibonacci series of numbers using recursion(...)
    This is bad. Recursive fibonacci calls twice the same function with same parameters, like:
    Code:
    int fib(int n){
        if(n<=0) return 0;
        else if(n==1) return 1;
        return fib(n-1)+fib(n-2);
    }
    But of course this is only for learning purposes. And something this simple you'd never burst a stack. But you get the point

  2. #17
    Registered User
    Join Date
    Oct 2004
    Posts
    3

    Thank you!!!

    Thank you for your hrlp guys I really appreciate it.I'm really sorry if I caused any inconvinience.
    Kermit, we have barely started Recurssion in college & we are suppose to find this program on the net.anyway thanks everyone.

  3. #18
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    um...it won't run in c#............uh, it's a standards thing

  4. #19
    Registered User
    Join Date
    Oct 2004
    Posts
    3
    Now worries.I got the basic idea & the program is running.

  5. #20
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Even though Prelude and Salem weren't amused, I was. And I think both Prelude and Salem were amused, they are just being more mature as they are aware that the person who asked the question most likely attempted compiling your code.

  6. #21
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Well it was a funny joke, and if he tried handing it in, he would deserve whatever he got from his teacher.

    Quote Originally Posted by jazzistoobad
    Kermit, we have barely started Recurssion in college & we are suppose to find this program on the net.anyway
    I still don't think you get the point. Asking for people to write your program for you (no matter how small) is not the point of this board. Asking for someone to code your homework assignment is even less appropriate. I am a carpenter by trade and to me, like many other professions, time is money. If somebody from another trade comes to me and asks me to cut a piece of wood for them, I will likely do it. But if they ask for a lot more than one (depending on how busy I am, 5 cuts might be too much) I will tell that person to go away. And if anybody asked me to do something like say, lay out and build a set of stairs, without expecting to compensate me for my time, I would tell them no. Similarily, there are a number of professionals on this board who get paid quite well for the programming they do. They offer their help free of charge, therefore I think it is reasonable to expect that there is a limit to the generosity here.

    If you wanted a C program, you would have done well to search the web, or perhaps even this board (yes it has a search function). I am sure you would have found what you were looking for. As an aside, if you understand what the program is to do, you might have at least have made an attempt at coding some of it - a little bit of effort goes a long way on this board - write what you can, and then ask for help when you can't go further.

    ~/
    Last edited by kermit; 10-04-2004 at 05:19 PM.

  7. #22
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Kermit, that was very well put. Like he said, show us what you got. We can help fix it. Thats a more realistic request than showing us an assignment and saying "do this I am sillyI am sillyI am sillyI am sillyI am sillyes."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fibonacci prime
    By dbzx in forum C Programming
    Replies: 5
    Last Post: 04-17-2009, 11:13 AM
  2. fibonacci using recursion?
    By n3cr0_l0rd in forum C Programming
    Replies: 12
    Last Post: 02-25-2009, 08:49 AM
  3. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  4. Fibonacci series using recursion
    By IPCHU in forum C Programming
    Replies: 1
    Last Post: 12-07-2006, 06:05 AM
  5. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM