Home » C Programming » Decision Making » Question
  1. What will be the output of the following C code? (Assuming that we have entered the value 2 in the standard input)
     #include <stdio.h>
    void main()
    {
    int num;
    printf("Enter a value between 1 to 2:");
    scanf("%d", &num);
    switch (num)
    {
    case 1:
    printf("1\n");
    break;
    printf("Hey...");
    default:
    printf("2\n");
    }
    }
    1. 1
    2. Hey...
    3. 2
    4. Compilation Error
    5. Runtime Error
Correct Option: C

2



Your comments will be displayed only after manual approval.