C program to generate fibonacci series.

 

01 #include <stdio.h>
02
03 int main()
04 {
05 int a,b,c,i,n;
06
07 a=0;
08 b=1;
09 printf("n enter n for how many times generate series");
10 scanf("%d",&n);
11 printf("nFIBONACCI SERIESn");
12 printf(" %d %d",a,b);
13
14 for(i=0; i<n; i++)
15 {
16 c=a+b;
17 a=b;
18 b=c;
19 printf(" %d",c);
20 }
21
22 return 0;
23 }
 
 
OUTPUT :


enter n for how many times generate series 5

FIBONACCI SERIES
0 1 1 2 3 5 8
 

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *