/**********************************
  File:  hw2p1.c

read a list of positive integers, 
and display the smallest.  0 is the
sentinel value.
***********************************/

#include <stdio.h>
#include "simpio.h"

void main()
{
  int i=0, max=0;  /* it's good form to initialize all variables */

  /* note: in the following while condition, TRUE could be replaced by 1
     and it would work identically.  TRUE is not part of standard C, but
     is included in genlib.h, which is included as part of simpio.h
  */

  while (TRUE) {     /* keep reading integers until sentinel found */
    printf("Enter an integer: ");
    i = GetInteger();
    if (i == 0)   /* sentinel found, stop reading integers */
      break;
    if (i > max)  /* larger integer read in, update max */
      max = i;
  }
  printf("The largest integer was: %d\n", max);
}
