i'm doing a exercise, where i should to sum the numbers until that the user put zero, then to print at console, the average of the numbers, the problem is that when i use the variable named "result" do not divide the operation that i put
My code:
Scanner scanner = new Scanner(System.in);
int number = 0;
int counter = 0;
do {
System.out.println("Digit the numbers: ");
number = scanner.nextInt();
number += number;
counter++;
}while(number > 0);
int result = number / counter;
System.out.println("the average of the numbers is -> "+ result);