Question #251600
x = 1

What is the value of x after each of these statements

a. if x+2=3 then x:=x + 1

b. if (x+1=3) OR (2x+2=3) then x:=x+1

c. if (2x +3=5) AND (3x +4= 7) then x= x + 1

d. if (x+1=2) XOR (x+2=3) then x:=x+1

e. if x < 2 then x:=x + 1
1
Expert's answer
2021-10-18T16:01:38-0400

a) x=2x=2 ; statement x+2=1+2=3 is true, so x:= x+1=1+1=2


b) x=1x=1 ; 1+1\neq 3 and 2+2\neq 3, so x=1


c) x=2x=2 ; 2+3=5 and 2+4=7, so x:=x+1=2


d) x=1x=1 ; (x+1=2) is true, (x+2=3) is true, true XOR true is false, so x=1


e) x=2x=2 ; 1 < 2, so x:= x+1=2


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!
LATEST TUTORIALS
APPROVED BY CLIENTS