Program for Fibonacci Series in C

In this instructional exercise, you will find out about the program for Fibonacci arrangement in c.

The Fibonacci arrangement is a grouping of numbers wherein the next number in the succession is gotten by including past two numbers.

For instance 0, 1, 1, 2, 3, 5, 8, 13.

Beneath I have shared C program to execute it.

Program

#include<stdio.h>
 
int main()
{
	int first=0,second=1,third,i,n;
 
	printf("Enter how many elements?");
	scanf("%d",&n);
	printf("\n%d %d",first,second);
 
	for(i=2;i<n;++i)
	{
		third=first+second;
		printf(" %d",third);
		first=second;
		second=third;
	}
	
	return 0;
}

Output

Leave a Comment

error: Alert: Content is protected!!