# standard deviation in need help!!!

Printable View

• 02-27-2004
voltare
standard deviation in need help!!!
Hello to anyone,

median - there is no equation for median. It it the value such that there are an equal number of values larger and smaller. For an odd number of values, if they are sorted, it is value in the middle of the list. If there are an even number of values, it is the mean of the middle two grades.

double median(int grades[], int num);

This function takes as input, num, the number of grades in the array, and grades, a pointer to the array in main. It finds the median grade in the array and returns this value. The simplist way of finding the median is to sort the grades by value. Then you can find the index for the median grade by using the definition for median above (it will be the middle index if there are an odd number of grades, or you will have to average the two middle grades if there are an even number). You can use the bubble sort function to do the sorting.

Here is my code if any one can help please
• 02-27-2004
quzah
How about you tell us actually what you're having problems with, rather than force us to debug your entire program? Now then, had you actually read the forum rules, you'd have done so.

Quzah.
• 03-01-2004
DavT
This probably doesn't answer the question you are asking
(which isn't that all that clear by the way) but one thing that
struck me when looking at your code is that you need to be
a bit more careful when the input to a function is int and the
output is double or float. Take a look at this noddy example...
Code:

```#include <stdlib.h> #include <stdio.h> int main (void) {   int a = 3, b = 2;   double c;   c = a/b;   printf("%d/%d = %f (mmm... )\n", a, b, c);   c = (double)a / (double)b;   printf("%d/%d = %f (ahh, that's better...)\n", a, b, c);   return 0; }```
As for how to calculate the median, the clue is in the question: ...
sort the list ... find the middle value.