public class J5_1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
java.util.Scanner input = new java.util.Scanner(System.in);
System.out.print("Enter an integer , the input ends if it is 0: ");
int positives = 0;
int negatives = 0;
double total = 0;
double average = 0;
int count = 0;
boolean i = true;
while(i) {
int a = input.nextInt();
if(a==0)
break;
else if(a>0)
positives++;
else if(a<0)
negatives++;
count++;
total +=a;
}
average = (average+total)/count;
System.out.println("The number of positives is "+positives);
System.out.println("The number of negatives is "+negatives);
System.out.println("The total is "+total);
System.out.println("The average is "+average);
}
}
public class J5_1 { public static void main(String[] args) { // TODO Auto-generated method stub java.util.Scanner input = new java.util.Scanner(System.in); System.out.print("Enter an integer ...