Open In App

C | Loops & Control Structure | Question 19

Like Article
Like
Save
Share
Report




#include <stdio.h>
int main()
{
    int i = 3;
    while (i--)
    {
        int i = 100;
        i--;
        printf("%d ", i);
    }
    return 0;
}


(A) Infinite Loop
(B) 99 99 99
(C) 99 98 97
(D) 2 2 2


Answer: (B)

Explanation: Note that the i–- in the statement while(i-–) changes the i of main()
And i== just after declaration statement int i=100; changes local i of while loop.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads