# Simple Standard Deviation Program without an Array

Discussion in 'Programming' started by davemoosehead, Feb 12, 2008.

Joined:
Feb 12, 2008
Messages:
2
0
Trophy Points:
0
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.

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}

Joined:
Feb 12, 2008
Messages:
2
0
Trophy Points:
0
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!

Joined:
Feb 6, 2008
Messages:
9