Вы находитесь на странице: 1из 1

Operator Exercise

1. Write a relational expression which would evaluate to true if the sum of variables x and y
was equal to the value of a variable z.
2. Bracket the following logical expressions to show the order of evaluation of the
operators. Hence if a is 5, b is 10, c is 15 and d is 0 what are the truth values of the
expressions?
c == a+b
a ! = 7
b <= a
a > 5
a+d >= c- b
d/ a < c*b
3. Bracket the following logical expressions to show the order of evaluation of the
operators. Hence if a is 5, b is 10, c is 15 and d is 0 what are the truth values of the
expressions?
c == a+b | | c == d
a ! = 7 && c >= 6 | | a+c <= 20
! ( b <= 12) && a %2 == 0
! ( a >5) | | c < a+b
4. Write a logical expression which returns true if a f l oat variable x lies between -10.0 and
10.0.

Вам также может понравиться