Question #333544

1.      What is the value of x after each of these statements is encountered in a computer program, if x = 1 before the statement is reached?

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


1
Expert's answer
2022-04-26T13:28:13-0400

Since the statement 1+2=31+2=3 is true, it follows that after the command "if x + 2 = 3 then x := x + 1" the value of xx is equal to 1+1=2.1+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