what is the output of the following program? Void main() { printf(“1”); Goto…

2026

what is the output of the following program?

Void main()

{

printf(“1”);

Goto xyz;

printf(“2”);

xyz;

printf(“3”);

}

Type '50' in the answer if there is compile time or run time error in the above code.

  1. A.

    1 2

  2. B.

    23

  3. C.

    1 2 3

  4. D.

    13

Attempted by 141 students.

Show answer & explanation

Correct answer: D

The program starts by printing '1' using printf. The goto statement then transfers control to the label xyz, skipping the printf("2"). Execution continues at the label xyz, where '3' is printed. Therefore, the output is '13'.

Explore the full course: Coding For Placement