Program to Display Fibonacci series in C using For loop|E-studyblog

 Program to Display Fibonacci series in C using For loop

In this program, you will get knowledge to Display Fibonacci series in C using for loop. 

Program to Display Fibonacci series in C using For loop
 Program to Display Fibonacci series in C using For loop



Fibonacci series in C:

Fibonacci number: A series of number (Fibonacci) in which each number is the sum of the two previous number. Fibonacci series begins with 0(zero),followed by 1 (one).

Example:0,1,1,2,3,5,8,13,21,34

Fibonacci series in C using For loop:


//C program to calculate  the Fibonacci series using for loop
#include <stdio.h>
int main(){
int n,f1=0,f2=1,temp,i;
printf("\nEnter number of Fibonacci series :");
scanf("%d",&n);
for (i=0;i<n;i++)
{
	if(i<=1)
	temp=i;
	else
	{
		temp=f1+f2;
		f1=f2;
		f2=temp;
		
	}
 printf("%d\n",temp);
}
return 0;
}

Output:

Program to Display Fibonacci series in C using For loop

I hope you have read our Article "C  Program to Display Fibonacci series in C using For loop"and  you have collected lots of information from there.If you like the post,then please comment and share among your friends and family. you can write your opinion about my post in the comment box. 


Thank you!


No comments:

Post a Comment

If you have any queries ,please let us know

C Program to Check whether the number is Even or Odd|how to find odd and even numbers in c programming|E-studyblog

I n this Article, you will learn how to   Check  whether the number is  Even or odd. We have shared the source code of odd and even number i...