if (condition) {
// code to execute if the condition is true
} else {
// code to execute if the condition is false
}
Explanation:
The if-else statement is a decision-making statement that is used to decide whether the part of the code will be executed or not based on the specified condition (test expression).
If the given condition is true, then the code inside the if block is executed, otherwise the code inside the else block is executed.
Sample code:
Program.c
output:
output.c
Resources :
Featured
Special title treatment
With supporting text below as a natural lead-in to additional content.