Professional Documents
Culture Documents
C Programming: Day 5 (Use of Else If With Logical Operator, Ternary Operator)
C Programming: Day 5 (Use of Else If With Logical Operator, Ternary Operator)
C Programming: Day 5 (Use of Else If With Logical Operator, Ternary Operator)
Day 5
(Use of else if with logical
operator,Ternary operator)
Use of if else with logical operator
• We use logical operators with if-else statement when we want to
check multiple conditions.
• Example
if(zone=='East')
{
shipping_charge=15.00;
}
else
{
shipping_charge=10.00;
}
//ternary operator
shipping_charge = (zone=='East') ? 15.00 : 10.00;