Page 14 - PowerPoint Presentation
P. 14
Logical Operator
• Exercise: what are the values of these expressions?
int pH=100, humidity=19;
1.(pH==100)&&(humidity<20)
2.(pH*humidity>pH/humidity)&&(humidity%2==0)
3.(pH!=0)&&(humidity>19)
4.(pH*0<0)&&(humidity*-1>=0)
5.(pH*0<0)||!(humidity*-1>=0)
6.(pH/pH!=1)||(humidity/pH>0)
7.(pH/pH!=1)||(humidity/pH>=0)