Question: C++ Count positive and negative numbers and compute the average of numbers (Required) Write a program that prompts the user to enter the number of

C++

Count positive and negative numbers and compute the average of numbers (Required)

Write a program that prompts the user to enter the number of integers to read. Your program should do the following things:

Read the values using a while loop.

Determine the numbers entered positive or negative.

Count how many positive and negative values have been read.

Outputs the sum of all the numbers that are greater than zero, the sum of all the numbers less than zero, and the sum of all the numbers, whether positive, negative, or zero.

Calculate the average of all the numbers. Display the average as a floating-point number (three digits after the decimal point).

Your program should not ask the user to enter the positive numbers and the negative numbers separately. Allow the user to repeat as many times as they would like before ending the program.

Here is the sample run:

Enter the number of integers: 5

Enter values: 1 2 -1 -3 9

The number of positive numbers is 3

The number of negative numbers is 2

The sum of all positive numbers is 12

The sum of all negative numbers is -4

The total is 8

The average is 1.600

Would you like to repeat (Y or N): Y

Enter the number of integers: 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!