English, asked by deepikaroy314, 5 hours ago

var i = 10;
switch(i) {
case 10: i+=2; break;
case 10: i+=5; break;
case 10: i+=4; break;
default: i+=3;
}
console.log(i)​

Answers

Answered by jahra805
0

Answer:

the answer will be 12

Explanation

the first case of the switch statement will be performed , After performing the condition it breaks and comes out of the switch loop.

Answered by anjalin
0

The output of the given snippet is 12

Explanation:

  • The switch statement in C is an alternative to the if-else-if ladder statement that permits us to execute multiple operations for the various possibles values of one variable referred to as the switch variable.
  • Here, we will define varied statements within the multiple causes for the various values of one variable.
  • When a break statement is encountered within a loop, the loop is suddenly terminated, and therefore the program management resumes at succeeding statement following the loop.
  • It is accustomed to terminating a case within the switch statement.
  • So the switch can enter with i = 10 and can enter in first case ten and can increment I by +2.
  • So I'll be twelve and so management goes to interrupt the statement that finally ends up the switch case.
  • So the console.log can output the worth of I as twelve.
  • Hence, the output of the given program is twelve.
Similar questions