Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Simple Standard Deviation Program without an Array (http://www.go4expert.com/forums/simple-standard-deviation-program-array-t8765/)

davemoosehead 12Feb2008 08:37

Simple Standard Deviation Program without an Array
 
I'm in an introductory Java course and our first assignment has me stumped. It will read a series of numeric scores (integers) until -1 is read, then calculate standard deviation. We also must determine the highest score, average, and other numbers. But the catch is no arrays. I don't know how to find standard deviation without recording down the set of numbers. :confused:

Just to make sure I have the right concept of SD, don't I first have to find the mean, and then subtract it from each score? Square each number and add them up, divide by n-1, then find the square root.

sqrt{ sigma[(x - xbar)^2] / n-1}

davemoosehead 12Feb2008 08:48

Re: Simple Standard Deviation Program without an Array
 
ok i figured it out. a different formula can be used...

sqrt{ [ n(x1^2 + x2^2...) - (x1 + x2...)^2] / n(n-1) }

no need for array, thanks!

sandymalhotra 12Feb2008 12:03

Re: Simple Standard Deviation Program without an Array
 
Cooooolllll


All times are GMT +5.5. The time now is 04:13.