// Ch. 18 Demo Program #3
// Mr. Minich
// Purpose - to illustrate the use of a recursive function to compute Fibonacci sequence

#include <iostream>
using namespace std;

int fib(int);

int main()
{
		int num = 6;

		for (int i = 1; i <= 10; i++)
		{
			cout << fib(i) << endl;
		}

		return 0;
}// end of main

int fib(int num)
{
	if (num > 3)
	{
		return fib(num - 1) + fib(num - 2);
	}
	if (num == 1)
	{
		return 0;
	}
	else if (num == 2)
	{
		return 1;
	}
	else if (num == 3)
	{
		return 1;
	}
	else	// num is less than or equal to 0
	{
		return 0;
	}

}// end of fib