Thanks. I did this instead:
sum += numbers and
avg = ((double) sum / total)
Type: Posts; User: Elyril
Thanks. I did this instead:
sum += numbers and
avg = ((double) sum / total)
I changed my loop and compute to this
//do-while loop w/ sum inside
do {
System.out.print("Enter any positive or negative number (0 ends program): ");
numbers = input.nextInt();
...
Enter any positive or negative number (0 ends program): -5
Enter any positive or negative number (0 ends program): 2
Enter any positive or negative number (0 ends program): -10
Enter any positive...
Thanks for that. I just added
else if (numbers == 0) {total--;} into the nested if's and it counted right, but now, I found out my averages, even if I go put a negative into the equation, the...
What do you mean to add code to test for the 0 with an if statement?
So, my code compiles fine and everything with a do-while loop, but when it counts how many numbers there are and averages them all, the count adds the 0 and the average also includes the 0 which I...