C program to print fibonacci series 0 1 1 2 3 5 8.....
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,i,n;
clrscr();
printf("Enter how many elements?");
scanf("%d",&n);
printf("\n%d %d",a,b);
for(i=2;i<n;++i)
{
c=a+b;
printf(" %d",c);
a=b;
b=c;
}
getch();
}
No comments:
Post a Comment
Comments : Read Them Or Add One to promote us