Here is the C code for the Fibonacci series:
Here is the C code for the Fibonacci series:
```c#include
int main()
{
int n, i, t1 = 0, t2 = 1, nextTerm;
printf("Enter the number of terms: ");
scanf("%d", &n);
printf("Fibonacci Series: ");
for (i = 1; i <= n; ++i)
{
printf("%d, ", t1);
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
}
return 0;
}
```
In this code, the user inputs the number of terms they want to see in the Fibonacci series. Then, it uses a `for` loop to print out each number in the series, starting with 0 and 1. The loop goes for the number of terms the user requested, and in each iteration calculates the next term in the series by adding the previous two terms together.
What's Your Reaction?