FIBONACCI SERIES FROM ITERATIVE APPROACH
FIBONACCI SERIES FROM ITERATIVE APPROACH
INPUT
#include <stdio.h>
int main()
{
int a = 0;
int b = 1;
int n;
printf("Enter the no. of series\n");
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
printf("%d\n",a);
b = a + b;
a = b - a;
}
return 0;
}
OUTPUT
Enter the no. of series
5
0
1
1
2
3
Comments
Post a Comment