What is the output of the following C program? #include <stdio.h> int main() {…

2018

What is the output of the following C program? #include <stdio.h> int main() { int index; for (index = 1; index <= 5; index++) { printf("%d", index); if (index == 3) continue; } }

  1. A.

    1245

  2. B.

    12345

  3. C.

    12245

  4. D.

    12354

Attempted by 671 students.

Show answer & explanation

Correct answer: B

Loop runs from index = 1 to 5

printf("%d", index); executes before continue

continue does not skip printf here

All values from 1 to 5 are printed

Output: 12345

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Up Lt Grade Assistant Teacher 2025