0

1.5kviews

Write a C program to generate the first n terms of the Fibonacci sequence using while loop

**1 Answer**

0

1.5kviews

Write a C program to generate the first n terms of the Fibonacci sequence using while loop

0

193views

written 18 months ago by |

**Code:-**

```
#include<stdio.h>
#include<conio.h>
void main()
{
int f0,f1,f,n,i;
printf("Enter the no of values in Fibonacci Sequence ");
scanf("%d",&n);
f0=0;
f1=1;
printf("FIBONACCI SEQUENCE FOR THE FIRST %d TERMS:\n",n);
i=0;
while(i<n)
{
printf("%d\t",f0);
f=f0+f1;
f0=f1;
f1=f;
i=i+1;
}
}
```

**Output:-**

ADD COMMENT
EDIT

Please log in to add an answer.