mean and median using arrays, help!!

This is a discussion on mean and median using arrays, help!! within the C Programming forums, part of the General Programming Boards category; Can someone send me code on how to use a user input of ten numbers into and array, and then ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    Unhappy mean and median using arrays, help!!

    Can someone send me code on how to use a user input of ten numbers into and array, and then how to find the mean (average) and the median (middle number when numberss are sorted) of the ten numbers the user inputs? Before the median is printed it need to print the numbers sorted first. Help me out, Im lost!

  2. #2
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Code:
    int main()
    {
       //code goes here
       return 0;
    }

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2

    ...........

    we have a comedian...

  4. #4
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Why should I do your homework?

  5. #5
    The Unregistered One
    Guest
    Mean should be pure simplicity. Just run the array through a loop, adding each element to a sum variable. Then divide the sum by the total numbers of the array(10 in your case).
    The Median is a little more difficult, but still no big deal. After sorting the elements of the array you have to take the 5th and 6th element, add them up, and divide by 2 to give you your median since your dealing with an even number of elements.That should be plenty of help.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21