Math, asked by akansha3199, 1 year ago

Write a program of fibonacci series in c

Answers

Answered by puramsnigdha246
1
The program output is also shown below.* C program to generate Fibonacci Series. Fibonacci Series.* is 0 1 1 2 3 5 8 13 21 ...{int fib1 = 0, fib2 = 1, fib3, limit, count = 0;printf("Enter the limit to generate the Fibonacci Series \n");scanf("%d", &limit);printf("Fibonacci Series is ...\ n");printf("%d\n", fib1);
Answered by RaviKumarNaharwal
1
#include <stdio.h>
int main()
{
int i, n, 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;
}


Similar questions