What is the output for total after the following segment of code executes? int num = 3,
Question:
What is the output for total after the following segment of code executes?
int num = 3, 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;
}
WriteLine("The value of total is " + total);
a. 10
b. 15
c. 14
d. 28
e. none of the above
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
C# Programming From Problem Analysis To Program Design
ISBN: 9781285856872
5th Edition
Authors: Barbara Doyle
Question Posted: