/* Iterative program to print Fibonacci sequence. doubles are used, as the values get big fast. */ #include main() { double prev1=1, prev2=1, next; printf("%2.0f\n%2.0f\n", prev1, prev2); /* Display first two terms */ do { next = prev1 + prev2; /* Compute next term */ printf("%2.0f\n", next); /* display */ prev1 = prev2; prev2 = next; /* advance the saved terms */ } while (next < 1000.0); return 0; }