Tugas Algoritma 4b
March29
Soal :
1. Assuming that x is 1, show the result of the following Boolean expressions.
• (true) && (3 > 4)
• !(x > 0) && (x > 0)
• (x != 1) == !(x == 1)
• (x >= 0) || (x < 0)
2. List the precedence order of the Boolean operators. Evaluate the following expressions:
• 2 * 2 – 3 > 2 && 4 – 2 > 5
• 2 * 2 – 3 > 2 || 4 – 2 > 5
3. Is (x > 0 && x 0) && (x 0 || x < 10 && y 0 || (x < 10 && y < 0))?
Jawaban :
Hasil : a. false
b. false
c. true
d. true
Hasil : a. false
b. false
Hasil :
true true
true true
www.binus.ac.id