/* 
 * Author:     Wil Schrader
 * Date:       9/1/2009
 * Version:    1.0
 * Class:      CIT 131 / Fall 2009 
 *
 * Assignment: 3) Arithmetic Operators
 *                Ask the user to input three integers.
 *                Print the sum, average, product, smallest,and largest of the numbers.
 */
#include <stdio.h>

/* Main Function */
int main( void ) {

   int n1, n2, n3;
   int sum, smallest, largest;

   /* Ask the user to input three integers */
   printf( "Input three different integers: " );
   scanf( "%d %d %d", &n1, &n2, &n3 );

   sum = n1 + n2 + n3;

   /* Print the sum, average, and product */
   printf( "Sum is %d\n", sum );
   printf( "Average is %d\n", (sum / 3) );
   printf( "Product is %d\n", (n1 * n2 * n3) );
   
   /* Determine the smallest and largest numbers */
   largest = n1;
   smallest = n2;

   if ( n1 < n2 ) {
      largest = n2;
      smallest = n1;
   } /* End If */
   
   if ( largest < n3 ) {
      largest = n3;
   } /* End If */
   
   if ( smallest > n3 ) {
      smallest = n3;
   } /* End If */

   /* Print the smallest and largest numbers */
   printf( "Smallest is %d\n", smallest );
   printf( "Largest is %d\n", largest );

   return 0; /* Program Ended Successfully */

} /* End Main Function */
