Code:
#include <stdio.h>
void main()
{
int valc[5]; //valc = Value Count (Amount of Numbers Entered).
int number; //Number for what calculation the user requests.
float average; //Average
int n; //Variable Number for For Loop
int max=0; //Max Number
float sum; //the sum of the inputs
for (n=0;n<5;n++)
{
printf("Please enter your values\n\n");
scanf("%d",&valc[n]);
printf("\n");
}
printf("\nWhat would you like to calculate from these numbers?\n\n");
printf("1. Find the Average of the numbers entered\n");
printf("2. Find the Maximum number entered\n"); //User enters what they are looking for.
printf("3. Find the Minimum number entered\n");
printf("4. Find the Standard Deviation of the numbers entered\n\n");
scanf("%d", &number); //Scans the number the user has input.
if (number==1) //If function that checks if the input was equal to 1.
{
printf("\nFind the Average of the numbers entered\n\n");
sum=valc[0]+valc[1]+valc[2]+valc[3]+valc[4]; //Sum of all 5 inputs.
average=sum/5; //Sum divided by the amount of inputs.
printf("The Average of the values entered was: %.2f\n\n",average); //Result of calculation
}
if (number==2) //If function that checks if the input was equal to 2.
{
printf("\nFind the Maximum number entered\n\n");
}
if (number==3)
{
printf("\nFind the Minimum number entered\n");
}
if (number==4)
{
printf("\nFind the Standard Deviation of the numbers entered\n");
}
}