What is value of y after the following switch statement is e
What is value of y after the following switch statement is executed? x = 3; y = 3; switch (x + 3){case 6: y = 1; default: y += 1;}
Solution
Following is the code which you want to execute:-
#include <iostream>
using namespace std;
int main()
{
int x=3;
int y=3;
switch(x+3){
case 6:y=1;
default: y+=1;
}
cout << \"The value of Y is \" << y << endl;
return 0;
}
After the code is execute,
The value of Y is 2.
