A12 Answer


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

/* Puzzle A12 -- print the ODD integers from 147 down to 59, 
|  seven per line. End the last line with "\n", even if the 
|  line has fewer than seven numbers on it.
*/
int main(int argc, char *argv[])
{
  int j;
  int start=147, finish=59;
  int count = 0;
  
  for (j=start; j>=finish; j -= 2 )
  {
    printf("%4d", j);
    if ( count%7==6 ) printf("\n");
    count++ ;
  }
  if ( count%7 != 0 ) printf("\n");
  
  system("PAUSE");	
  return 0;
}

Comments: The count is handled differently here than in the last program. Play with both methods.