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

Popular posts from this blog

Program for calculating Simple Interest using the concept of Default Arguments

Program: Maximum number in three numbers in visual basic

Program for Checking whether the given number is Palindrome or not