Write a program that reads an unspecified number of integers, determines how man
ID: 3529952 • Letter: W
Question
Write a program that reads an unspecified number of integers, determines how many positive and egative values have been read and computes the total and average of the input values (not counting 0). Program ends with the input 0. Display the average as a floating point number. Should look something like: Enter an interger, the input ends if it is 0; The number of positives is..... The number of negatives is....... The total is...... The average is...... Thanks for your helpExplanation / Answer
#include #include using namespace std; int main() { int count =0; int sum = 0; int positivecount = 0; int negativecount = 0; double average; cout count; while(count != 0) { sum += count; average = sum / static_cast(count); count++; if(count < 0) { negativecount++; } if (count > 0) { positivecount++; } cout count; } coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.