Learn C ProgrammingLearn ProgrammingPrograms On ArraysResources

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

By September 18, 2012 September 18th, 2019 No Comments
#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();
}


Leave a Reply

DEMO01