Computer Science, asked by Anonymous, 1 year ago

please give the output of this snippet with correct explanation ..when the value of i=0

Attachments:

Anonymous: hey,mohit bhaiya, why you blocked me?!
Anonymous: what are you doing brother??
Anonymous: no..its unblocked now

Answers

Answered by anuj
7
Hi friend ,

Since there is no given case such as 0 ,So at the time of execution the switch case goes to default .

Default statement is the statement which has a working similar to the else statement .


Since no case is matched with 0 hence it goes ultimately to the default.
Hence the output will be


Fail is incremented
ua=0 ub=0
uc=0. Fail =1





We see that u haven't used break in Ur questions ....so this is a case of FALL THROUGH..BUT SINCE U HAVE GIVEN A VALUE OF i=0 which doesn't matches with any case so directly it goes to the default control of the statement.




Images attached are of output with i=0 when break used and not used ... Hope it helps!!!!!!!!!!!!!!!!!!!



Attachments:
Similar questions