Page 1 of 1

with JAVA language (Count positive and negative numbers and compute the average of numbers) Write a program that reads a

Posted: Sat Nov 27, 2021 2:34 pm
by answerhappygod
with JAVA language
(Count positive and negative numbers and compute the average of
numbers) Write a program that reads an unspecified number
of integers, determines how many positive and
negative values have been read, and computes the total
and average of the input values (not counting zeros).
Your program ends with the input 0. Display the average
as a floating-point number.
Sample of run program
Enter an integer the input ends if it is 0:
-44 -33 -12 15 89 45 113 117 45 0
The number of positives is: 6
The number of negatives is: 3
The total is: 335.0
The average is: 37.22
Tips:
Without using method, only main method and Use while with
if statements and scanner, println for input and output