Answer to Question #239077 in Discrete Mathematics for Vic

Question #239077

StatethevalueofxafterthestatementifP(x)thenx:=1

b)x=1.

a)x=0.

isexecuted,whereP(x)isthestatement“x>1,”ifthe

valueofxwhenthisstatementisreachedis

c)x=2.


1
Expert's answer
2021-09-20T16:35:54-0400

Let us state the value of "x" after the statement

"``"if "P(x)" then "x:=1"",

where "P(x)=``x>1"," in the following cases:


a) If "x=0," the statemet "P(x)," that is "``0>1"" is false, and hence after the command "``"if "P(x)" then "x:=1"" the value of "x" is equal to 0.


b) If "x=1," the statemet "P(x)," that is "``1>1"" is false, and hence after the command "``"if "P(x)" then "x:=1"" the value of "x" is equal to 1.


c) If "x=2," the statemet "P(x)," that is "``2>1"" is true, and hence after the command "``"if "P(x)" then "x:=1"" the value of "x" is equal to 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

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS