Questions 15-17 refer to the following program segment:
int i = 0, g = 0, s = 0, t= 0, z = 0;
string sValue;
while (i < 5)
{
inValue = Console.ReadLine( );
t = Convert.ToInt32(inValue);
s = s + t;
if (t > -1)
g = g + 1;
else
z = z + 1;
i = i + 1;
}
}
The value stored in variable z at the end of the execution of the loop could best be described as:
a. the number of positive items entered
b. the sum of all positive items entered
c. the number of negative items entered
d. the sum of all negative items entered
e. the sentinel value
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.