Your average is only going to show integers. So the average of 2 and 3 is going to show as 2 not 2.5. When you do the division for the average, you should cast the int values to double so that the division yeilds a double result rather than an int result. You also have a couple of unused variables (counter and num).