+ 2
Int x=3; switch(x) { case1: { x+=x;} case3: {x+=x;} case5:{x+=x;} default: {x+=5;} } cout x
what's the output of this question
12 Réponses
+ 2
but the answer is 17
+ 2
and now I understand the answer as break is not there so it execute all the cases below the case 3 also so the output is 17
+ 2
thanks for your help in indirect way
+ 2
and the answer is 17
+ 1
this question is asked when I play challenge in this app
+ 1
no the question is right and the language is c++
+ 1
it's not compulsory
+ 1
yes the program is right you can run on your pc
+ 1
Yes the answer is 17. Compiler execute the case 3. Then case 5 then default because not found break in each case. Or in each case 3 only.
+ 1
it will be 17
case 3 = 3+3 then x=6
case 5 = 6+6 then x=12
default = 12+5 then x will be "17"
0
The answer is 11
0
This program is right