I wanna wright C programe to find value F(n)value with in(0=<n<=20),pr ogramme must be we input n valu then we get out put F(n) value.
fibonacci sequence
F(n)=F(n-1)+F(n-2)
but i got this error
Building fib.exe.
POLINK: fatal error: Access is denied.
*** Error code: 1 ***
Done.
plz find the error in this progm..
fibonacci sequence
F(n)=F(n-1)+F(n-2)
Code:
#include<stdio.h>
int main()
{
int n,ans=0,n1=0,n2=0,i,p;
printf("enter n:");
scanf("%d",&n);
p=n;
if(n==0)
printf("%d",n1);
if(i==1)
printf("%d",n2);
else
for(i=0;i<p-2;p++)
{
ans=n1+n2;
n1=n2;
ans=n2;
}
printf("%d",ans);
return 0;
}
Building fib.exe.
POLINK: fatal error: Access is denied.
*** Error code: 1 ***
Done.
plz find the error in this progm..
Comment