#include<stdio.h>
#include<stdlib.h>
int main (int argc, char *argv[])
{
int n, first = 0, second = 1, next, c;
n = atoi (argv[1]);
printf ("These are %d values in Fibonacci series are by atnyla:-\n",n);
for (c = 0; c < n; c++)
{
if (c <= 1)
next = c;
else
{
next = first + second;
first = second;
second = next;
}
printf ("%d\n", next);
}
return 0;
}
10
These are 10 values in Fibonacci series are by atnyla:-
0
1
1
2
3
5
8
13
21
34
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.