construct a logical expression to represent each of the following conditions.
(1) Mark is greater than or equal to 100 but less than 70.
(2) Num is between 0 and 5 but not equal to 2.
(3) Answer is either 'N' OR 'n'.
(4) Age is greater than or equal to 18 and gender is male.
(5) City is either 'Kolkata' or 'Mumbai'.
Answers
Answered by
7
Answer:
a)70<Marks<=100
b)0<=num<=5 and num!=2
c)Answer=='N' or Answer=='n'
d)age>18 and gender="male"
e)if city="Kolkata" or city="Mumbai"
Answered by
0
1. Mark >= 100 AND Mark<70
- Here the variable is "Mark"
- The first condition for the value of "Mark" is that it can be greater than or equal to a hundred i.e. Mark >= 100
- The second condition for the value of "Mark" is less than 70 i.e. Mark<70
- As both conditions need to be satisfied, we use logical AND between them
- As a result, no number greater than 100 is ever less than 70.
2. Num > 0 AND Num<5 AND Num != 2
- Here the variable is "Num"
- The first condition for the value of "Num" is greater than 0.
- The second condition is that the value is less than 5.
- The third condition is that the number is not equal to 2 i.e. Num != 2.
- As all conditions need to be satisfied, we use logical AND between them.
3. Answer == 'N' OR Answer =='n'
- Here the variable is "Answer"
- To check the equality of a variable to a value, we use the equality operator i.e. "==".
- As either of the two conditions needs to be satisfied, we use logical OR between them.
4. Age >= 18 AND Gender == 'male'
- Here we have two variables i.e. "Age" and "Gender"
- The first condition is on the first variable that Age is greater than or equal to 18 i.e. Age >= 18.
- The second condition is on the second variable that Gender is male. So, we use the equity operation here.
- As both conditions need to be satisfied, we use logical AND between them.
5. City == 'Kolkata' OR City =='Mumbai'
- Here the variable is "City"
- To check the equality of a variable to a value, we use the equality operator i.e. "==" for both the condition checks.
- As either of the two conditions needs to be satisfied, we use logical OR between them.
To learn more about Logical Expressions, visit
https://brainly.in/question/13497501
#SPJ3
Similar questions