Home / C Programming / Control Instructions :: Discussion

Discussion :: Control Instructions

  1. Which of the following statements are correct about the below program?

    #include 
     int main()
     {    
         int i = 10, j = 20;    
         if(i = 5) && if(j = 10)           
            printf("Have a nice day");     
         return 0;
     } 
    

  2. A.

    Output: Have a nice day

    B.

    No output

    C.

    Error: Expression syntax

    D.

    Error: Undeclared identifier if

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    "Expression syntax" error occur in this line if(i = 5) && if(j = 10).

    It should be like if((i == 5) && (j == 10)).


Be The First To Comment