0

Hello! I just started learning C a few weeks ago and I'm having a problem with a program I'm writing

The program has to prompt the user for a certain number of values defined as NUM_VALUES, and then calculate the mean and standard deviation of the numbers.

Here's what I have so far:

```
#include <stdio.h>
#include <math.h>
#define NUM_VALUES 5
int main ()
{
int userinput[NUM_VALUES], i, j, k;
double mean, mean_divided, standard_deviation, temp, temp2;
printf("Enter 5 integers: ");
for ( i = 1; i <= NUM_VALUES; i++ )
scanf("%i", &userinput[NUM_VALUES]);
/* Program will get input from user NUM_VALUE times */
for ( k = 1; k <= NUM_VALUES; k++)
mean += userinput[NUM_VALUES];
mean_divided = mean / NUM_VALUES;
/* Calculates mean of inputed values*/
for ( j = 1; j <= NUM_VALUES; j++)
temp += pow(userinput[NUM_VALUES] - mean_divided, 2);
temp2 = temp / (NUM_VALUES - 1);
standardi_deviation = sqrt(temp2);
/* Calculates standard deviation of values*/
printf("mean = %.3f, standard deviation = %.3f\n", mean_divided, standard_deviation);
return 0;
}
```

Right now the program is able to compile, but when I run it I'm not getting the results i'm looking for. For example, when I input 1 2 3 4 5, I should be getting mean = 3.000 and standard deviation = 1.581, but right now i'm getting mean = 6.000 and standard deviation = 0.000. I need help finding the error within the logic of my program.

Thanks beforehand!