KodeGod.com

069. Write a program to accept a number n from user and print fibbonacci series up to nth level using arrays in C language

#include<stdio.h>
#include<conio.h>  
main()
{
	int a[20],n,i;
	clrscr();
	printf("Enter number : ");
	scanf("%d",&n);
	a[1]=a[2]=1;

	for(i=3;i<=n;i++)
		a[i]=a[i-1]+a[i-2];

	for(i=1;i<=n;i++)
		printf(" %d",a[i]);

	getch();
}