What is the output for total after the following segment of code executes?
int num = 4,
total = 0;
switch (num)
{
case 1:
case 2: total = 5;
break;
case 3: total = 10;
break;
case 4: total = total + 3;
break;
case 8: total = total + 6;
break;
default: total = total + 4;
break;
}
Console.WriteLine("The value of total is " + total);
a. 0
b. 3
c. 13
d. 28
e. none of the above
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'.