fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. char ch= 'R';
  6. int i=0;
  7. switch(ch)
  8. {
  9. if(ch=='R')
  10. {
  11. printf("If case entered\n");
  12. case 'B' : i=2 , printf("case B entered\n ");
  13. break;
  14. }
  15. else
  16. {
  17. printf("else case entered\n");
  18. case 'R' : i=3, printf("case R entered\n"); ;
  19. }
  20. default: i=5, printf("default case entered\n");
  21. }
  22.  
  23.  
  24.  
  25. printf("%d",i);
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 4380KB
stdin
Standard input is empty
stdout
case R entered
default case entered
5