The well-known Fibonacci number series, reputedly discovered by leornardo of Pis
ID: 3805736 • Letter: T
Question
The well-known Fibonacci number series, reputedly discovered by leornardo of Pisa around the year 1200, has been valued for centuries for its universal qualities by artists, mathematicians, and composers. Each number in the series ( need code in debugg the in that uses mov and bits) 4. Fibonacci Numbers The well-known Fibonacci number series, reputedly discovered by Leornardo of Pisa around the year 1200, has been valued for centuries for its universal qualities by artists, mathematicians, and composers. Each number in the series after the number 1 is the sum of the two previous numbers: l. 1, 2, 3, 5, 8, 13, 21, 34, 55. Write a program that generates and displays the first 24 numbers in the Fibonacci series, beginning with 1 and ending with 46.368.Explanation / Answer
#include <stdio.h>
int main()
{
int i, n=24, j = 1, k = 1, nextTerm = 0;
printf("Fibonacci Series: ");
for (i = 1; i <= n; ++i)
{
// Prints the first two terms.
if(i == 1)
{
printf("%d, ", j);
continue;
}
if(i == 2)
{
printf("%d, ", k);
continue;
}
nextTerm = j + k;
j = k;
k = nextTerm;
printf("%d, ", nextTerm);
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.