Print Fibonacci Numbers

For Complete YouTube Video: Click Here

In this class, we will understand the Print Fibonacci Numbers program.

The entire course of C Programming with more than 110+ videos of content or playlist has already been published.

We have covered all the concepts of C Programming in a very detailed way.

C Programming Complete Playlist on YouTube: Click Here

All the concepts discussed in this course are the models frequently asked in Campus Placements Questions, either in multiple-choice questions or as programming questions.

This entire course will help a Computer Science Engineering Student or a student in any other stream crack the campus placements drives held by Service-based Software or IT companies like TCS, Infosys, CTS, Wipro, Accenture, etc.

Print Fibonacci Numbers

Question

Print the Fibonacci numbers up to the specified number.

Given Code:

void printFibonacci(int num)
{
	int i;
	long sum=0;
	long num1=0;
	long num2=1;
	for(i=1;i<num;++i)
	{
		print("%d ",num1);
		sum=num1+num2;
		num2=sum;
		num1=num2;
	}
}

In the above code, there are some mistakes in the problem.

The explanation of the question is provided in the above YouTube link.