Home‎ > ‎Assignments‎ > ‎

PosNeg

You have a stream of integers coming in from the input device. The integers are in random order. Some are positive, some are negative; only the last is zero.

 

(a) Write a program using functions to output the following:

the number of positive numbers

the number of negative numbers

the sum of the positive numbers

the sum of the negative numbers

the total number of numbers

the grand total of all the numbers

 

(b) Use functions to break down the problem and to make your program easy to follow (readable).


Comments