C Language



Admission Enquiry Form

  

If...Else If statement in C

What is If...Else If statement in C?

If...Else If is conditional statement in C.

Syntax of If...Else If statement...

if(condition)
{
//number of statements
}
else if(condition)
{
//number of statements
}



Example of If...Else If statement:


Output:

Enter a number 2
The number is positive

In the above example, if the user enters 2, If block will get executed , if user enters -2 first Else If block will get executed and if user enters 0 second Else If block will get executed.