If the Boolean expression is true then the code inside the if statement block is executed or if it is false then the code inside else statement will be executed. Hence if..else statement.
Syntax
Syntax of if...else statement in C Language:
1 2 3 4 5 6 7 8 | if (condition) { //code executed if condition true } else { //code executed if condition false } |
If…else Flowchart:

Example of if…else statement in C.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> void main() { int num1, num2; num1 = 56; num2 = 89; if (num1 > num2) { printf("num1 is greater than num2y"); } else { printf("num2 is greater than num1"); } } |
The output of if…else statement in C.
num2 is greater than num1