What is the output of following code:void main(){int i=5;switch(i){case 3: printf(“three”);case 4: printf(“four”);case 5: printf(“five”);case 6: printf(“six”);break;case 7: printf(“seven”);default: printf(“default”);}}a.fiveb.fivesixsevendefaultc.fivesixd.fivesixseven
Question
What is the output of following code:void main(){int i=5;switch(i){case 3: printf(“three”);case 4: printf(“four”);case 5: printf(“five”);case 6: printf(“six”);break;case 7: printf(“seven”);default: printf(“default”);}}a.fiveb.fivesixsevendefaultc.fivesixd.fivesixseven
Solution
The output of the given code is:
five six seven default
Similar Questions
What will be the output of the following program?#include<stdio.h> int main() { int i=4; switch(i) { default: printf("This is default."); case 1: printf("This is case 1"); break; case 2: printf("This is case 2"); break; case 3: printf("This is case 3"); } return 0; }Select one:This is default.This is case 1This is case 3This is default.This is case 1
What will be the output of the following code snippet?1234567891011121314151617#include <stdio.h> int main() { int x = 20; switch (x) { case 10: if (x == 10) printf("Ten "); case 20: if (x == 20) printf("Twenty "); case 30: printf("Thirty "); default: printf("Other "); } return 0; }
What will be the output of the following code ?#include<stdio.h>int main(){char c='A';switch(c){case 64+1: printf("hello ");break;case 8*8+4: printf("world ");break;default: printf("myworld");}printf("welcome");}
Select the correct answerWhat will be the output of the following code?int b = 7;switch (b) { case 6: System.out.println("Six"); break; case 7: System.out.println("Seven"); break; case 8: System.out.println("Eight"); break; default: System.out.println("Default");}OptionsEightSevenSixDefault
What will be the output of the following code?public class Solution { public static void main(String args[]) { int i = 5; switch(i) { case 1: System.out.print("Case 1" + " "); break; case 2: System.out.print("Case 2" + " "); break; case 3: System.out.print("Case 3" + " "); break; default: System.out.print("Value of i is greater than 3" + " "); } } }Options: Pick one correct answer from belowCase 1Case 2Case 3Value of i is greater than 3PrevSubmit MCQNext
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.