What will be the output of the following program?#include<stdio.h> int main() { int i=3; switch(i) { case 1: printf("Hello"); case 2: printf("Hi"); case 3: continue; default: printf("Bye"); } return 0; }Select one:Compilation ErrorNo outputByeHello Hi
Question
What will be the output of the following program?#include<stdio.h> int main() { int i=3; switch(i) { case 1: printf("Hello"); case 2: printf("Hi"); case 3: continue; default: printf("Bye"); } return 0; }Select one:Compilation ErrorNo outputByeHello Hi
Solution
The output of the program will be a Compilation Error. The reason is that the 'continue' statement is not allowed outside of a loop. In this case, it is used inside a switch statement, which is incorrect. Therefore, the compiler will throw an error.
Similar Questions
What is the output of the following C Program?
What will be the output of the following code?
what will be the output of the c program?
What will be the output of the following C++ code?
What will be the output of the following program?Note: This question helps in clearing the AMCAT exam
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.