// july21ex1.cpp : Defines the entry point for the console application.
// Keep accepting donations until either a single donatin is over a
// half million dollars, or the average donation is over $10,000
//  At the end, print the total donations, the average donation, and
//  the largest donation

#include "stdafx.h"

int main(int argc, char* argv[])
{

	float donation, tot_don=0.0, avg_don, max_don=-999.99;
	int num_don=0;


	do   {

        printf("Please type your donation amount: ");
		scanf("%f", &donation);
        tot_don += donation;
		num_don++;
		avg_don = tot_don / num_don;

        if (donation > max_don) max_don = donation;


	} while  ( (donation <= 500000.00) && (avg_don <= 10000.00));


	printf("Num of donations = %d \n", num_don);

	printf("Total donations = $%6.2f \n", tot_don);

	printf("Average donation = $%6.2f \n", avg_don);

	printf("Largest donation = $%6.2f \n", max_don);

	return 0;
}