0

int x=3; switch(x){case 1: x+=x; case 2: x+=x; case 5: x+=x; default : x+=x}; cout<<x; output?

25th Aug 2020, 7:05 AM
Harsh Kant
Harsh Kant - avatar
6 odpowiedzi
+ 3
rkk sir how answer will be 48. here value of x is 3 so there is no case matching so default will print x+=x =3+3=6 cout will print 6
25th Aug 2020, 7:08 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 3
rkk yaa!! I ve too seen many people 😅 Human compiler 😂😂 Lol
25th Aug 2020, 7:24 AM
Namit Jain
Namit Jain - avatar
+ 1
48 :')
25th Aug 2020, 7:06 AM
RKK
RKK - avatar
+ 1
Aniket Sandhilya that was intentionally.(to make him curious) He could have just copy and pasted the code in the code playground himself and check the output rather than asking here. (if he don't understand how is the output something then that's another thing)
25th Aug 2020, 7:12 AM
RKK
RKK - avatar
+ 1
rkk 😂😂😂🤣
25th Aug 2020, 7:14 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
No offense to anyone.(and a bit Offtopic) But Namit Jain my stay in SoloLearn has been a funny one especially in this Q/A forum. I've seen many people just copy pasting some code snippets as question and instead of asking why and how the codes is working, they simply ask what is output? Weird, right! Cause it makes me feel like I'm some sort of Compiler or what not. (Now, some human Compiler would say if you feels like compiler then just don't answer.) 😅
25th Aug 2020, 7:17 AM
RKK
RKK - avatar