Answer:
A pixel,This is the answer.
Answer:
The code solution is written in Python.
- positiveSum = 0
- negativeSum = 0
- num = int(input("Enter a number: "))
- while(num != 0):
- if(num > 0):
- positiveSum += num
- else:
- negativeSum += num
- num = int(input("Enter a number: "))
- print("Sum of positive number: " + str(positiveSum))
- print("Sum of negative number: " + str(negativeSum))
Explanation:
Firstly, we need to create two variables, <em>positiveSum</em> & <em>negativeSum</em>, to hold the running total of the positive and negative input numbers. (Line 1 - 2)
Next, use Python in-built method<em> input()</em> to prompt user for the first input number and assign it to variable <em>num</em>. (Line 4)
Create a <em>while-loop </em>by setting the condition as while input number is not equal to 0, the program shall positive to add the current input number to either variable<em> positiveSum</em> or <em>negativeSum</em>. (Line 6 -10) If the input number is bigger than zero, the current input number should be added to variable<em> positiveSum</em> else it should add to variable <em>negativeSum</em>.
Next, the program shall proceed to prompt user for the next input number. (Line 12)
The entire process is repeated until user enters zero to exit the while loop.
Lastly, display the total of positive and negative numbers. (Line 14 - 15)
Answer:
Agent, an electronic agent.
Explanation:
Not sure what quizScore1-5 is, but here it is. Also, I'm not entirely sure what language you're working with here, but null can't be returned as an integer. If it were a string, for example, it'd be possible as string is an object reference type.
public int getData(int dataNumber)
{
if (dataNumber == 1)
return quizScore1;
else if (dataNumber == 2)
return quizScore2;
else if (dataNumber == 3)
return quizScore3;
else if (dataNumber == 4)
return quizScore4;
else if (dataNumber == 5)
return quizScore5;
else
return 0;
}