FIBONACCI SERIES
#include “conio.h”
#include”stdio.h”
void main()
{
int a=0,b=1,y=0,i,n;
clrscr();
printf("\nEnter the limit : ");
scanf("%d",&n);
printf("\nThe Fibonacci Series of %d numbers :",n);
for(i=0;i
{
printf(" %d",y);
y=a+b;
b=a;
a=y;
}
getch();
}
Output will be
Enter the limit : 6
The Fibonacci Series of 6 numbers : 0 1 1 2 3 5 8 13 21 34
No comments:
Post a Comment