/* a7-3-4.c */
#include <stdio.h>

int main(void)
{
	int array1[10] = {10, 15, 22, 45, 9, 66, 71, 4, 37, 82};
	int *p;
	int i, sum = 0, max, min;
	double avg;

	/* 合計値を求める */
	p = array1;
	for (i = 0; i < 10; i++) {
		sum += *p;
		p++;
	}

	/* 平均値を求める */
	avg = sum / 10.0;

	/* 最大値と最小値を求める */
	p = array1;
	max = min = *p;
	for (i = 1; i < 10; i++) {
		p++;
		if (max < *p) {
			max = *p;
		}
		if (min > *p) {
			min = *p;
		}
	}

	printf("合計値 = %d\n", sum);
	printf("平均値 = %.1f\n", avg);
	printf("最大値 = %d\n", max);
	printf("最小値 = %d\n", min);

	return 0;
}
