program for printing fibonacci series
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c=1,e=1,n;
printf("enter the
number");
scanf("%d",&n);
do
{
printf("%d\n",b);
b=a+e;
a=e;
e=b;
c=c+1;
}while(n>=c);
getch();
}
Output
enter the number 4
1
1
2
3
Comments
Post a Comment