Answer L5

#include <stdio.h>
#include <stdlib.h>

/* Puzzle L05 -- print the integers from 15 down to 0, one per line */
int main()
{
  int j;
  for (j= 15; j >= 0; j-- )
  {
    printf("%3d\n", j);
  }

  return 0;
}

No big problem here, but counting backwards is sometimes not as clear as counting forwards. Notice the ending condition of the loop.



Back to Puzzle Home