Q. When 2 is entered, The output of the code below is?

Code:
#include <stdio.h> 
void main()
 {      
  int ch;        
printf(“enter a value btw 1 to 2:”);        
scanf(“%d”, &ch);       
 switch (ch)      
  {              
 case 1:             
  printf(“1\n”);             
  break;              
 printf(“Hi”);             
  default:               
printf(“2\n”);    
    }
 }
  • (A) 1
  • (B) Hi 2
  • (C) Run time error
  • (D) 2
πŸ’¬ Discuss
βœ… Correct Answer: (D) 2

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
257
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
92%
Success Rate