Knowee
Questions
Features
Study Tools

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

🧐 Not the exact question you are looking for?Go ask a question

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

1/4

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.