Science, asked by manishjanghel18, 8 months ago

this program right or wrong?

C Program to print fibonacci series up to no
terms */
# include <stdio.h>
# include <conio.h>
int main ( )
{
int i,n, t1=0, t2 = 1, next Term;
printf ("Enter the number of terms: ");
scanf ("%d", &n);
printf ("Fibonacci series: ");
for (i=1; i<=n; ++i)
{
printf ("%d",t1);
next Term = t1+t2;
t1+t2;
t2 = next Term;
}
retuan 0;
}


Output
Enter the number of terms: 10
Fibonacci series : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34​

Answers

Answered by Anonymous
2

Answer:

it should be t1=t2 instead of t1+t2

Similar questions