Value of x After Logic & Math Task w/ x=2

  • MHB
  • Thread starter vb14
  • Start date
  • Tags
    Logic
In summary, the value of x remains at 2 after each statement is encountered in the computer program. The IF parts for all three statements are false, so the THEN parts do not execute and x remains unchanged.
  • #1
vb14
8
0
Hi Folks,
I am stack with following task:What is the value of x after each of these statements is encountered in a
computer program if x=2 before the statement is reached?

(i) if (6+2=9) then x:=x+1 .
(ii) if ((3+2=5) OR (2+3=3))then x:=x+1 .
(iii) if ((12+4=17) AND (4+5=9)) then x:=x+1.

Note 1 OR is ∨ AND is ^
Note 2 := is an assignment sign.Any help will be appreciated.
Thanks.
 
Physics news on Phys.org
  • #2
Is the IF part of i) true?
Is the IF part of ii) true?
Is the IF part of iii) true?
 
  • #3
Ackbach said:
Is the IF part of i) true?
Is the IF part of ii) true?
Is the IF part of iii) true?

(i) false
(ii) false
(III) false
 
  • #4
vb14 said:
(i) false
(ii) false
(III) false

(ii) is incorrect. The first part of the OR is true, making the entire OR true. So, which THEN parts will execute?
 
  • #5
tell me please the answer is 3:)
 
  • #6
vb14 said:
tell me please the answer is 3:)

Correct!
 
  • #7
Thanks a lot, I feel like a genius now!:D
 

FAQ: Value of x After Logic & Math Task w/ x=2

What is the value of x after completing the logic and math task with x=2?

The value of x will depend on the specific instructions and operations given in the logic and math task. Without knowing the specific task, it is impossible to determine the value of x.

How is the value of x affected by the logic and math task?

The value of x can be affected by the logic and math task depending on the operations and instructions given. It is important to carefully follow the instructions and perform the correct operations in order to obtain the desired value of x.

Can the value of x change during the logic and math task?

Yes, the value of x can change during the logic and math task if the instructions and operations given involve manipulating the value of x. However, if x is defined as a constant value, it will not change throughout the task.

Is the value of x the only important factor in completing the logic and math task?

No, the value of x is just one component of the task. Other important factors include following the given instructions, using the correct mathematical operations, and understanding the logic behind the task.

What should I do if I am unsure of the value of x after completing the logic and math task?

If you are unsure of the value of x, it is important to double check your work and make sure you followed all the instructions correctly. You can also seek help from a teacher or peer to verify your answer.

Similar threads

Replies
1
Views
1K
Replies
17
Views
1K
Replies
1
Views
1K
Replies
6
Views
2K
Replies
40
Views
7K
Replies
1
Views
1K
Replies
8
Views
2K
Replies
2
Views
1K
Replies
7
Views
1K
Back
Top