Professional Documents
Culture Documents
Lecture 4
by
Imran Kazmi
In the Previous Lecture
• Type Declaration Instructions
• Arithmetic Instructions
• Input / Output Instructions
• Control Instructions
Decision
Decision
• If the person’s age is equal to or greater than 18
years than he/she can apply for the driving
license.
• If the height of the player is not less than 6 ft
than he can join basket ball team.
• Minimum marks to qualify for the next class is
50%.
• Bonus is granted on minimum 5 years of service.
If Statement
If condition is true
statements
If (condition)
statement ;
If Statement
If ( condition )
{
statement1 ;
statement2 ;
:
}
Relational Operators
• && AND
• || OR
• ! NOT
• Where logical NOT is a unary operator and other two are
binary operator.
• Logical AND gives result true if both the conditions are
true, otherwise result is false. And logical OR gives result
false if both the condition false, otherwise result is true.
•Programming
Practice
if-else
if (condition)
{
statement ;
-
-
}
else
{
statement ;
-
-
}
if-else
Entry point for IF-Else block
IF
Condition
Then
Process 1
Else
Process 2