Predict output for the following code.
#include<stdio.h>
void main() {
int ch=2;
switch(ch)
case 1: printf("test1");
case 2: printf("test2");
Answers
Answered by
1
Answer:
Output:-
test2
Reason:-
value of ch is 2 therefore second case will executed....
Answered by
1
Answer:
output:
test2
(because ch is 2 so case 2 will be executed.if ch is 1 then output will be test1 test2 because no break statement is used.)
Explanation:
Similar questions