I have no idea how to make a program that will calculate the standard deviation of 10 numbers. I dont even know the formula. I just learned of arrays the day before and our professor gave this assignment.
Any help??
Printable View
I have no idea how to make a program that will calculate the standard deviation of 10 numbers. I dont even know the formula. I just learned of arrays the day before and our professor gave this assignment.
Any help??
At the very least, search the Web for a formula that you can implement.
i got the formula
but no idea where to start and how to solve this problem..!>!>>!~
So, what is the formula that you intend to use?
Unless I'm missing something, you have to rip through the array to first calculate the average of all the elements. Start with that and print out the average. Hand-calculate it also to double check. Then loop through again applying the formula. Maybe there's a way to do it all at once.
it is not being helpful to me..
sorry guys but im really having trouble with it.
the formula i got is...http://en.wikipedia.org/wiki/Standard_deviation from here..
now can sum1 help me
That article provides several versions of the formula. Which do you intend to implement?
OK, let's get your program started. Post it with the headers: stdio.h.
Let's use the Wikipedia set of numbers so we'll be sure when it's right or wrong:
I'll refer to the first formula (the easiest one).Code:int a[8] = {2,4,4,4,5,5,7,9};
Using a for loop, how would you calculate the average (median) of these numbers?
You have great timing - I just finished putting together a program, from the Wikipedia site!
Quite amazing coincidence, since the thread had drifted to the second page of the forum.
Edit:
This is a very simple formula, so don't let the math give you a headache - it's ez:
1) Go thru the list of numbers in the array, and add them all up
2) Divide by the number of numbers that you have - in our example it's 40/8 = 5, which is our Median or Average
3) Now subtract that average, from all those numbers in the same list, and
4) Square the sum or those numbers you got in #3, above
5) Now take the sqrt() of that number you got in #4. That's the standard deviation.
So it's really just using simple arithmetic, except for the square root right at the last step.
i get the steps. Thanks. But no idea of how to put it in programming language..
help
Well, you'll need to include a standard header file, and put in your main() function. Then declare some variables - some integers and two doubles.
You'll need a for or while loop to make that addition of all the numbers, so you can find the average.
You can find for and while loops sprinkled all over the net, including this very forum.
You need to seriously get off your arse and get *doing*, however. Your helpless act has worn thin, already.
Post what you can do. We can help you with the rest of it, but no assistance should be given, if you aren't willing to work on this, and show some actual effort.
Despite what it may sound like, this is in fact, a trivial program.
show us whatever you've done so far then we can get your program to run.Quote:
i get the steps. Thanks. But no idea of how to put it in programming language..
help