Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

in c use a function named as fibonacci create fibonacci series for first10 numbers any one help me

OpenStudy (anonymous):

The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... The next number is found by adding up the two numbers before it. The 2 is found by adding the two numbers before it (1+1) Similarly, the 3 is found by adding the two numbers before it (1+2), And the 5 is (2+3), and so on

OpenStudy (woodrow73):

Learn about loops -- have it go through the loop 10 times, and each time have it print out the next term in the fibonacci sequence. By declaring multiple variables, and understanding that the next term in the fibonacci sequence is simply the previous 2 terms added together, I'm sure you can figure out something. As far as c syntax- I can't help there.

OpenStudy (e.mccormick):

What did you come up with so far?

OpenStudy (anonymous):

/* Fibonacci Series c language */ #include<stdio.h> int main() { int n, first = 0, second = 1, next, c; printf("Enter the number of terms\n"); scanf("%d",&n); printf("First %d terms of Fibonacci series are :-\n",n); for ( c = 0 ; c < n ; c++ ) { if ( c <= 1 ) next = c; else { next = first + second; first = second; second = next; } printf("%d\n",next); } return 0; } When the program prompts, you enter 10.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!