Question
Write a C++ program to read five whole numbers (integers) and perform the following: (1) Display the largest and smallest of the numbers (2) Display
Write a C++ program to read five whole numbers (integers) and perform the following: (1) Display the largest and smallest of the numbers (2) Display the average of the numbers (3) Display sum of the negative numbers (4) Display sum of positive numbers (5) Display how many numbers are even and how many are odd
This is what I have so far, my issue is 1st off I cannot figure out how to incorporate step 5 into the other 4 and whenever I run the program the 1st number inputted is not calculated towards to sums or the average and I cannot figure out why.
For example if I put in, -2,1,2,3,4. It tells me the lowest is -2 and highest is 4 but when it adds the negative and positive it will give negative sum as 0 and positive as 10, and the avg does not calculate correctly because -2 is not included in the calculation.
#include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started