can you please explain what is wrong with my code? i've been trying different ways, but always one of the tests won't pass
package com.codegym.task.task05.task0507;
import java.util.Scanner;
/*
Arithmetic mean
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int num = 0;
double arithmeticMean = 0.0;
int count = 0;
int sum = 0;
while (true) {
num = sc.nextInt();
count++;
sum += num;
if (num == -1) {
arithmeticMean = (double) ((sum + 1) / (count - 1));
System.out.println(arithmeticMean);
break;
}
num++;
}
}
}