だから私は(EX)を作ろうとしていました:1 -2 -325正の数の数は5負の数の数は-3合計は3平均は.6私はこのようにしたかったのですがそれを実行すると、どの部分がエラーであるかは機能しません???
import java.util.*;
public class Welcome {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter an int value, the program exits if the input is 0: ");
int num = input.nextInt();
int countpos = 0;
int countneg = 0;
int totalnum = 0;
int total = 0;
double avg = 0.0;
while(num != 0){
if(num < 0)
countpos++;
else
countneg++;
total = total + num;
totalnum++;
}
System.out.print("num of pos is: " + countpos);
System.out.print("num of neg is: " + countneg);
System.out.print("total is: " + total);
System.out.print("the avg is: " + total / totalnum );
}
}