What will be the Output? int i = 0; while(i < 3) { printf("%d ", i); i--; }

Question image

Understand the Problem

The question is asking what will be the output of a given piece of C code which includes a while loop that prints the value of i initially set to 0 and decrements it until a certain condition is met. The user needs to analyze the code behavior to determine the correct output among the provided options.

Answer

Infinite loop

The final answer is: Infinite loop

Answer for screen readers

The final answer is: Infinite loop

More Information

The loop keeps decrementing i, making it negative and always satisfying the i < 3 condition.

Tips

Remember that a decreasing value without an exit condition creates an infinite loop. Ensure loop variables are modified to eventually meet the exit condition.

AI-generated content may contain errors. Please verify critical information

Thank you for voting!
Use Quizgecko on...
Browser
Browser