// grocery1.cpp : Defines the entry point for the console application.
// This program prompts for the num of items to buy.  It then reads in
// those number of items,and prints a total.

#include "stdafx.h"

int main(int argc, char* argv[])
{    int num_items, item, cost, total, max, min;

     item = 1;
	 total = 0;
	 max=-9999;

	 printf("\nPlease type in the num of items you wish to buy: ");
	 scanf ("%d", &num_items);

	 while (item<= num_items) {
        printf("Type cost of item # %d ", item);

		scanf ("%d", &cost);
        total =total + cost;


		if (cost > max)
			max = cost;
		if (item==1)
			min = cost;
		if (cost < min)
			min = cost;
		item = item + 1;
	 } /*end while item */


     printf("\n The total cost is $%d \n", total);

	 if (num_items > 0) {
		 printf("The average cost per item is $ %d\n", total/num_items);
	     printf("The highest price was $ %d\n", max);
		 printf("The lowest price was $ %d\n", min);
	 } /*end if num_items */

	return 0;
}