Answer to Question #167482 in Discrete Mathematics for Caleb Kudzuh

Question #167482

State the value of x after the statement if P(x) then x:=1 is executed, where P(x) is the statement

“x > 1,”

Given that thevalue of x when thisstatement is reachedis [3 marks]

a) x=0

b) x=1

c) x =2


1
Expert's answer
2021-03-01T07:12:43-0500

Consider the statement "if P(x)P(x) then x:=1x := 1" which is equivalent to "if x>1x>1 then x:=1x := 1"


a) If x=0x=0, then the statement P(0)="0>1"P(0)="0>1" is false, and thus the value of xx is equal to 0 after the statement "if P(x)P(x) then x:=1x := 1".


b) If x=1x=1, then the statement P(1)="1>1"P(1)="1>1" is false, and thus the value of xx is equal to 1 after the statement "if P(x)P(x) then x:=1x := 1".


c) If x=2x=2, then the statement P(2)="2>1"P(2)="2>1" is true, and thus the value of xx is equal to 1 after the statement "if P(x)P(x) then x:=1x := 1".



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment