Examveda
Examveda

What will be the output of the following code?
#include<stdio.h>
void main()
{
    int s=0;
    while(s++<10)
    {
        if(s<4 && s<9)
        continue;
        printf("%dt", s);
    }
}

A. 1 2 3 4 5 6 7 8 9

B. 1 2 3 10

C. 4 5 6 7 8 9 10

D. 4 5 6 7 8 9

E. None of these

Answer: Option C

Solution(By Examveda Team)

'If' statement only true when value of 's' is less then 4

Control Structures mcq solution image


This Question Belongs to C Program >> Control Structures

Join The Discussion

Comments ( 6 )

  1. Shehzana Kanwal
    Shehzana Kanwal :
    6 years ago

    in case of 0,1,2 and three why it is not printed cant understand

  2. Examveda
    Examveda :
    7 years ago

    Hello Guys Solution of the above question is update. Please check it.

  3. Praveen Kumar
    Praveen Kumar :
    7 years ago

    Guys please tell me how is it possible??

  4. NITIKA GARG
    NITIKA GARG :
    7 years ago

    i think the answer will be d because of the presence f break it will again go to the continue and ultimately it will hang

  5. Lucky Rathod
    Lucky Rathod :
    7 years ago

    How is the output

  6. Sanchit Singh
    Sanchit Singh :
    7 years ago

    Ans is d not c becz when s =10 condition will be false so while loop will not execute

Related Questions on Control Structures