The problem is from Introduction to
(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.
If you entire input is 0, display 'No numbers are entered except 0.'
Sample Run 1
Enter an integer, the input ends if it is 0: 1 2 -1 3 0
The number of positives is 3
The number of negatives is 1
The total is 5
The average is 1.25
Sample Run 2
Enter an integer, the input ends if it is 0: 0
No numbers are entered except 0
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images
- Please code using C++ and only use header <iostream>. Any other headers will not be accpeted. Thank you!arrow_forwarduse the following question by C and the output should be same as picturearrow_forwardWrite a C++ program that takes a 4-digit number from user as and input and displays all the combinations of those digits.For Example: Enter number: 5321Possible Combinations are:5321, 5312, 5231, 5213, 5123, 5132 3521, 3512, 3251, 3215, 3125, 31521523, 1532, 1253, 1235, 1325, 1352 2513, 2531, 2153, 2135, 2315, 2351arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education