mean_value function
1. Definition:
The mean (average) value (arithmetic) of a set of values is equal to their sum
divided by the number of the related values.
2. The method in C language:
#include <stdio.h>
int get_number()
{
int num;
printf("\n How many numbers do you have ?: --> ");
scanf("%d", &num);
return num;
}
int main()
{
int num = get_number();
float numbers[num];
printf("\n Enter these %d numbers:\n",num);
int i;
for (i = 0; i<num;i++)
{
scanf("%f", &numbers[i]);
}
float mean_value;
float sum = 0;
for (i = 0; i<num;i++)
{
sum = sum + numbers[i];
}
mean_value = sum/num;
printf("\n The sum of these numbers is %5.2f \n", sum);
printf("\n Their mean value is %5.2f \n", mean_value);
return 0;
}