Write a program that prompts the user to enter 10 integer values, which can be positive or negative, and calculates:

computer science

Description

Write a program that prompts the user to enter 10 integer values, which can be positive or negative, and calculates: 


• the sum of all the positive integers the user entered 

• the sum of all the negative integers the user entered


You must use a single for loop to accomplish this. 

Your program should then output the total sum of the positive numbers and the total sum of the negative numbers. 


When you analyse the problem make sure you consider the following factors: 

• how many times the loop is repeated? 

• what operations are done before the loop? 

• what operations are done inside the loop? 

• what operations are done after the loop?


Related Questions in computer science category