Program to find the Fibonacci value of any given number from 1 to 100.
#include<conio.h>
void main()
{
int num,f[100];
cout<<"Enter a number to find Fibonacci value : ";
cin>>num;
f[0]=0;
f[1]=1;
for(int i=2;i<=num;i++)
{ f[i]=f[i-1]+f[i-2];}
cout<<f[num];
getch();
}
No comments:
Post a Comment