Syntax of Simple if-else
——————————
if(condition)
{
statement1;
statement2;
.
.
.
statement n;
}
else
{
statement1;
statement2;
.
.
.
statement n;
}

Program:

Output:

Simple-If-Else_output

Explanation:
In the above program, if statements are executed if the condition is true. otherwise else statements are executed. And else statements are executed only if the if condition fails.

Leave a Reply

Your email address will not be published. Required fields are marked *