First of all there's error in your code.
The average for
numbers will be sum divided by the count of this numbers.
So your program hangs on the last entered zero.
I'd like to re-write it as follows:
Scanner sc = new Scanner(System.in);
int sum = 0;
int count = 0;
System.out.println("Enter the number: ");
num = sc.nextInt();
sum += num;
System.out.println("Enter 0 to end the loop: ");
if (num != 0) count = count + 1;
}while (num != 0);
System.out.println("sum is "+sum);
float avg = sum;
if (count > 0) avg = avg / count;
System.out.println("average is "+avg);