Home » C Programming » Decision Making » Question
  1. Which of the following statement are correct about the program given below?
    #include <stdio.h>
    int main ( )
    {
    int x = 10, y = 20;
    if (x == 15) && if (y == 20)
    printf ("Have a nice day\n");
    return 0;
    }
    1. Output: Have a nice day
    2. No output
    3. Error: 'Expression syntax'
    4. Error: 'Undeclared identifier if'
Correct Option: C

The correct form of if would be :
if ((x == 15) && (y == 20))
printf ( "Have a nice day\n");



Your comments will be displayed only after manual approval.