Solution to StatethevalueofxafterthestatementifP(x)thenx:=1 b)x=1. a)x=0. isexecuted,whereP(x)isthestatement“x>1,”ifthe valueofxwhenthisstatementisreachedis c)x=2. - Sikademy
Author Image

Archangel Macsika

StatethevalueofxafterthestatementifP(x)thenx:=1 b)x=1. a)x=0. isexecuted,whereP(x)isthestatement“x>1,”ifthe valueofxwhenthisstatementisreachedis c)x=2.

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question

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.

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-5-stid-8-sqid-1529-qpid-1267