Getting Started With C

if else statements

Syntax:

if (condition) {
// code to execute if the condition is true
} else {
// code to execute if the condition is false
}

Explanation:

Sample code:

Program.c

output:

output.c

Resources :

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Q1. What is the output of the C Program.?

                      int main()
                      {
                          if( 4 < 5 )
                              printf("Hurray..\n");
                              printf("Yes");
                          else
                              printf("England")
                      
                          return 0;
                      }

Q2. What is the output of the C Program.?

 
                      int main()
                      {
                          if( 10 < 9 )
                              printf("Hurray..\n");
                          else if(4 > 2)
                              printf("England");
                      
                          return 0;
                      }