C program to print fibonacci series

C program to print fibonacci series

Fibonacci series represents a set of numbers where the next number is equal to the sum of the previous two numbers. Ex: 0, 1, 1,2,3,5 etc. The first two numbers of the Fibonacci series are 0 and 1. So, we write a program to print the Fibonacci series.


/*
	Program to print Fibonacci Series
	Author 			: 		Krishna Teja G S
	Repository		:		github.com/packetprep/coding-questions
	Website			: 		packetprep.com
*/

#include

int main(){

	int number,i, first = 0 ,second = 1, third;

	printf("Enter the number of terms : ");
	scanf("%d",&number);

	// Fibonacci logic
	for(i =1; i<= number;i++){
		printf("%d \t",first);
		third = first + second;
		first = second;
		second = third;
	}

}
wipro free mock test
Wipro National Qualifier Test is just a few days away. To help you crack the exam we are sharing a mock test specially designed for Wipro based on all the previous papers.