Fibonacci series Program in C
Fibonacci series of n is next number is sum of previous two numbers for example ex: 0 1 1 2 3 5 8 13 21 etc. The first two number of fibonacci series are 0 and 1.
Fibonacci series program without recursion.
#include<stdio.h>
void main()
{
int n1=0,n2=1,n3,i,num;
printf("Enter the number");
scanf("%d", number);
printf("\n %d %d",n1,n2);
for(i=2;i<num;i++)
{
n3=n1+n2;
printf(" %d",n3);
n1=n2;
n2=n3;
}
}
Output:
Download