Solved

What Is the Output of the Following Segment of Code \quad

Question 19

Multiple Choice

What is the output of the following segment of code if the value 4 is input by the user?
int num;
int total = 0;
cout << "Enter a number from 1 to 10: ";
cin >> num;
switch (num)
{
case 1:
case 2:
\quad total = 5;
case 3:
\quad total = 10;
case 4:
\quad total = total + 3;
Case 8:
\quad total = total + 6;
default:
\quad total = total + 4;
}
cout << total << endl;


A) 0
B) 3
C) 13
D) 23
E) None of these

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions