Viewing code of FIBONAC
// ------ ../cgi-bin/cout/FIBONAC.CPP --------------
//--- Programmed By Rajesh -----

/*
This is a program to calculate fibonacci numbers with the use of
recursion
fibonacci.cpp
(Style of Computer Programming in C, V.Rajaraman)
Page no:283

see also fib1.cpp ==> without recursion
(Style of Computer Programming in C, V.Rajaraman)
Page no:113


and fib2.cpp ==> with recursion but another style
(style of GOTFRIED's book)


*/

#include<stdio.h>
#include<conio.h>
long int fib(int n)
{
long int result;
if (n==0)
return 0;
else
if(n==1)
return 1;
else
{
result = fib(n-1)+fib(n-2);
return result;
}
}
void main()
{
int input,i;
clrscr();

printf("Enter number of fibonacci numbers to generate:");
scanf("%d",&input);
for(i=1;i<=input;i++)
{
printf("\n%d",fib(i));
}
getch();
}