#include<stdio.h>
main()
{
int a=0,b=1,num,c,count;
printf("Enter a number to obtain fibonacci series\n");
scanf("%d",&num);
count=2;
while(count<num)
{
c=a+b;
a=b;
b=c;
printf("%d\n",c);
count++;
}
printf("The series is\n");
printf("%d \n%d\n",a,b);
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter a number to obtain fibonacci series
8
The series is
0
1
1
2
3
5
8
13