C output type question

Q.  C Programming :Trace the output
int main()
{

int x;

for(x=1;x <=10;x++);

printf("%d",x);

return 0;

}

- Published on 22 Jun 15

a. 1 2 3 4 5 6 7 8 9 10
b. 10
c. 11
d. None of the above.

ANSWER: 11
 

    Discussion

  • siya   -Posted on 16 Sep 18
    after for loop there is a semicolon thats means the body of loop is empty and when condition become false the output will be printed and ie 11.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)