Computer Science, asked by jotin61, 3 months ago

write a program to print the fibonacci serious up to 20th term​

Answers

Answered by aniiketsharma921
0

 #include<stdio.h>

int main()

{

int sum = 0, n=20;

int a = 0;

int b = 1;

printf("Fibonacci series: ");

while(sum <= n)

{

printf("%d ", sum);

a = b; // swap elements

b = sum;

sum = a + b; // next term is the sum of the last two terms  

}

return 0;

}

Similar questions
Math, 1 month ago