if statement.
The if statement controls conditional branching. The body of an if statement is executed if the value of the expression is nonzero. Or if statement is used to execute the code if condition is true. If the expression/condition is evaluated to false (0), statements inside the body of if is skipped from execution.
Syntax :
if(condition/expression)
{
true statement;
}
statement-x;
Practical Exercise: Click Here
If-else statement :
The if-else statement is an extension of the simple if statement. The general form is. The if…else statement executes some code if the test expression is true (nonzero) and some other code if the test expression is false (0).
Syntax :
if (condition)
{
true statement;
}
else
{
false statement;
}
statement-x;
Practical Exercise: Click Here