C program to display first n fibonacci numbers

Aim: Print first n fibonacci numbers using C.

#include<stdio.h>
#include<conio.h>
int main()
{
	int a,b,c,i,n;
	printf("Enter the limit : ");
	scanf("%d",&n);
	printf("\nThe first %d fibonacci numbers are :\n",n);
	for(a=1,b=0,i=0;i<n;i++)
	{
		c=a+b;
		printf("\n%d",c);
		a=b;
		b=c;
	}
	return 0;
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments