Lecture 03 - IFcodition
Lecture 03 - IFcodition
1. condition
If (condition)
{
Statement or group of statement
}
Example 1:
If (averAge is greater than 95 ) => instead of English like statement use relational operators
{
output "Ali can be a member of basketball team"
}
Solution:
start
end
• Example explanation
1. integer division truncate the decimal part
2. Relational operator > , other operators are <,>= , <=, != , == are the binary operators
Exmaple3 (Home work): A shopkeeper announces a package for customers that he will give 10
% discount on all bills and if a bill amount is greater than 5000 then a discount of 15 %(15.0/100
make sure about integer division). Write an algorithm which takes amount of the bill from user
and calculates the payable amount by applying the above discount criteria and display it on the
screen.