A03 Answer


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

/* Puzzle A03 -- print the  even integers 0, 2, 4, 6, ... , 20, one per line */
int main(int argc, char *argv[])
{
  int j;
  for (j=0; j<=20; j+=2 )
  {
    printf("%3d\n", j);
  }
  system("PAUSE");	
  return 0;
}

Comments: In some situations it might be more sensible to do this:

  for (j=0; j<=10; j++ )
  {
    printf("%3d\n", 2*j);
  }

This is a matter of taste, and context.