I have to create a code that uses functions and arrays to find mean and variance of N entered integers. My teacher has been gone for a while, so I'm quite lost with this subject. Help would be greatly appreciated!
int main()
{
double arr[10];
int size;
printf_s("Enter the value of N \n");
scanf_s("%d", &size);
printf_s("Enter %d real numbers \n", size);
for (int i = 0; i < size; i++)
{
scanf_s("%f", &arr[i]);
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
You either missed the closing tag or the dashed line is a problem.
You should decide if this is a C program or a C++ program. The C code at the beginning of main does not work well. I had a problem with it entering the proper numbers into the array. When I changed it to C++ code it worked fine.
Not sure yet if it works right yet. Need to find a way to check the variance. For now entering the numbers 1 - 6 produced the mean of 3.5, which I now is correct, and a variance of 3.2, have to check on that number.
Otherwise the program as a whole compiled and ran with no problems or errors.