Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program? #include<stdio.h> int main() { int i = 1; switch(i) { printf("Hello\n"); case 1: printf("Hi\n"); break; case 2: printf("\nBye\n"); break; } return 0; } ?->(Show Answer!)
1. What will be the output of the program? #include<stdio.h> int main() { int i = 1; switch(i) { printf("Hello\n"); case 1: printf("Hi\n"); break; case 2: printf("\nBye\n"); break; } return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.01 pm
switch(i) has the variable i it has the value '1'(one). Then case 1: statements got executed. so, it prints "Hi". The break; statement make the program to be exited from switch-case statement. switch-case do not execute any statements outside these blocks case and default Hence the output is "Hi".