#include
#include
int fab(int);
void main()
{
int i,n;
clrscr();
printf("\nENTER THE NO.UPTO WHICH YOU WANT THE SERIES=");
scanf("%d",&n);
printf("\n\n\n");
for(i=1;i<=n;i++)
printf("%d " ,fib(i));
getch();
}
int fib(int m)
{
if(m==1||m==2)
return(1);
else
return(fib(m-1)+fib(m-2));
}
/*----------------------------------------------------------------------
OUTPUT
------------------------------------------------------------------------
ENTER THE NO.UPTO WHICH YOU WANT THE SERIES=6
1 1 2 3 5 8
*/
No comments:
Post a Comment