help in recursion

This is a discussion on help in recursion within the C++ Programming forums, part of the General Programming Boards category; hi frend i have to generate fibonacii sequence with and without recursion i did it without and also atemp to ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    35

    help in recursion

    hi frend i have to generate fibonacii sequence with and without recursion i did it without and also atemp to do with recursion but io dont know how to my atemp is
    Code:
    #include<stdio.h>
    #include<conio.h>
    cot(int i);
    main()
    {
    clrscr();
    int i;
    i=cot(3);
    printf("%d\t",i);
    getch();
    }
    cot(int i)
    {
    int m;
    if(i==0)return(0),
    m=cot(i-1)+i;
    return(m);
    }
    i know this is wrong code but plz tell me what can i do to make fabonacii sequence

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    int main()

    int cot(int i)

    f(n) = f(n-1)+f(n-2) where n >1
    f(0) = f(1) = 1
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    35
    i cant understand
    plz code it in to my prog

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Quote Originally Posted by neha007
    plz code it in to my prog
    this is your job...

    what ecsactly you don't undestand?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 08:45 PM
  2. Recursion... why?
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 06-09-2008, 09:37 AM
  3. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 09:56 AM
  4. To Recur(sion) or to Iterate?That is the question
    By jasrajva in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 08:24 AM
  5. selection sorting using going-down and going-up recursion
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 01:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21