Could any help me through the flow of this loop? I understand the syntax, but I am trying to figure out the flow of the for loop and why it prints how it prints.
The output starts as:
0
1
1
2
3
5
...
why in the loop does it print zero, then two sets of 1's. When I try and follow the loop, I figure it to start 0 for the initial then 1,2...
Thanks
Code:#include <stdio.h>; int main (void) { int firstval = 0; int secondval = 1; int tempvalue, count = 15; for (count = 1; count <= 15; count++) { tempvalue = firstval + secondval; printf("%d\n", firstval); firstval = secondval; secondval = tempvalue; } getchar(); return 0; }