Solution to What is the value of x after each of these statements is encountered in a … - Sikademy
Author Image

Archangel Macsika

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

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

i) if x +2=5 then x := 3*x +5

Since 3+2=5 is a true statement, after the command "if x +2=5 then x := 3*x +5" the value of x is 3\cdot 3+5 =14.

Answerx = 14


ii) if (x +1=4) OR (2x +2=3) then x := x +1

Since 3+1=4 is a true statement, the statement (3 +1=4) \text{ OR }(2\cdot 3 +2=3) is also true, and thus after the command "if (x +1=4) OR (2x +2=3) then x := x +1" the value of x is 3+1=4

Answerx = 4

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-3195-qpid-1894