#include<iostream.h>
#include<conio.h>
int fib(int);
void main()
{
clrscr();
int a=0;
cout<<"\nEnter a no that u want to know fibnocci sequense of: ";
cin>>a;
cout<<fib(a);
}
int fib(int no)
{
if(no==0)
return 0;
else if(no==1)
return 1;
else
return fib(no-1)+fib(no-2);
}
#include<conio.h>
int fib(int);
void main()
{
clrscr();
int a=0;
cout<<"\nEnter a no that u want to know fibnocci sequense of: ";
cin>>a;
cout<<fib(a);
}
int fib(int no)
{
if(no==0)
return 0;
else if(no==1)
return 1;
else
return fib(no-1)+fib(no-2);
}
0 comments:
Post a Comment