Fibonacci Numbers Series Progression Using While Loop - C Programming Examples

Fibonacci Numbers Programming
As we have started C Programming coding with Example Series, We have published last posts
"Write A Program For SUM of Infinite HP"
"Write A Program To Find SUM of AP" and
"Write A Program To Find SUM of GP Sequence".
We have chosen to start with Arithmetic Series and in this post you will find some basic idea and some useful concepts about Fibonacci Numbers .You can download C Codes below.Please let us know your feedback.

Fibonacci Numbers Progression - Series - Sequence to Nth Term Step-wise Video Tutorial(See C- Codes Below ):

Fibonacci Sequence:-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!


Formula For Fibonacci Sequence:
Xn = Xn-1 + Xn-2

Where: Xn is term number "n"
Xn-1 is the previous term (n-1)
Xn-2 is the term before that (n-2)

When we take any two successive (one after the other) Fibonacci Numbers, their ratio is very close to the Golden Ratio "φ" which is approximately 1.618034...We can calculate any Fibonacci Number using the Golden Ratio:
Formula For Fibonacci Sequence Ingenuity Dias


Fibonacci Sequence
Write A Program In C To Find Fibonacci Numbers Progression - Series - Sequence to Nth Term:C Codes are written and tested in TuboC/C++ IDE as you can see in Video:

 #include<stdio.h>
int main()
{
int k=2,r;
long int i=0l,j=1,f;

printf("\n\nEnter the number range Of Fibonacci Series:");
scanf("%d",&r);

printf("Fibonacci series is: %ld %ld",i,j);

while(k<r){
f=i+j;
i=j;
j=f;
printf(" %ld",j);
k++;
}
delay(5000);
return 0;
}

To Find Fibonacci Series Using WHILE Loop
Result:
Enter the number range: 20
Fibonacci series is: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181

No comments