//Arrays Question 2 solution
#include <stdio.h>

void main()
{
	float temps[12];//Part a - set up array
	int i,choice;
	float total = 0;
	float average;

	//Part b - Allow the user to enter temperatures
	for (i = 0; i <= 11; i++)
	{
		printf("Please enter next temperature: ");
		scanf("%f", &temps[i]);
	}

	printf("------------------------------\n");

	//Part c - Print on the screen
	for (i = 0; i <= 11; i++)
	{
		printf("%.2f\n", temps[i]);
	}

	printf("------------------------------\n");

	//Part d - Select the element you want

	printf("Which array element would you like to see? ");
	scanf("%d", &choice);

	printf("The value at that position is %.2f\n", temps[choice]);

	printf("------------------------------\n");

	//Part e - find the average temperature (note: initialise total to 0 at the top)

	for (i = 0; i <= 11; i++)
	{
		total = total + temps[i];
	}
	average = total / 12;
	printf("The average temperature is %.2f\n", average);
}