Fibonacci Series in C

# C Fibonacci Series Program

How to Write a Program to Print Fibonacci Series in C programming using While Loop, For Loop, Functions, and Recursion?.

## Fibonacci Series in C

Fibonacci Series in C or Fibonacci Numbers are the numbers that display in the following sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34,…

If you observe the above pattern, First Value is 0, Second Value is 1, and the following number is the result of the sum of the previous two numbers. For example, Third value is (0 + 1), Fourth value is (1 + 1) so on and so forth.

## Fibonacci series in C using While Loop

This Program allows the user to enter any positive integer. And then, display the Fibonacci series of number from 0 to user-specified number using the While Loop in C programming.

```#include <stdio.h>
int main()
{
int Number, i = 0, Next, First_Value = 0, Second_Value = 1;

printf("\n Please Enter the Range Number: ");
scanf("%d",&Number);

while(i < Number)
{
if(i <= 1)
{
Next = i;
}
else
{
Next = First_Value + Second_Value;
First_Value = Second_Value;
Second_Value = Next;
}
printf("%d \t", Next);
i++;
}
return 0;
}```