• :00Days
• :00Hours
• :00Mins
• 00Seconds
A new era for learning is coming soon

Suggested languages for you:

Americas

Europe

Q42E

Expert-verified
Found in: Page 16

### Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095

# 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 ${\mathbf{x}}{\mathbf{+}}{\mathbf{2}}{\mathbf{=}}{\mathbf{3}}$ then ${\mathbf{x}}{\mathbf{=}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}$ b) if ${\mathbf{\left(}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}{\mathbf{=}}{\mathbf{3}}{\mathbf{\right)}}$OR ${\mathbf{\left(}}{\mathbf{2}}{\mathbf{x}}{\mathbf{+}}{\mathbf{2}}{\mathbf{=}}{\mathbf{3}}{\mathbf{\right)}}$ then ${\mathbf{x}}{\mathbf{=}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}$ c) if ${\mathbf{\left(}}{\mathbf{2}}{\mathbf{x}}{\mathbf{+}}{\mathbf{3}}{\mathbf{=}}{\mathbf{5}}{\mathbf{\right)}}$AND ${\mathbf{\left(}}{\mathbf{3}}{\mathbf{x}}{\mathbf{+}}{\mathbf{4}}{\mathbf{=}}{\mathbf{7}}{\mathbf{\right)}}$ then ${\mathbf{x}}{\mathbf{=}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}$ d) if ${\mathbf{\left(}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}{\mathbf{=}}{\mathbf{2}}{\mathbf{\right)}}$ XOR ${\mathbf{\left(}}{\mathbf{x}}{\mathbf{+}}{\mathbf{2}}{\mathbf{=}}{\mathbf{3}}{\mathbf{\right)}}$ then ${\mathbf{x}}{\mathbf{=}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}$e) if x < 2 then${\mathbf{x}}{\mathbf{=}}{\mathbf{x}}{\mathbf{+}}{\mathbf{1}}$

a) x = 2

b) x = 1

c) x = 2

d) x = 1

e) x = 2

See the step by step solution

## Definition of Statement

Mathematical statement is a sentence that is either true or false.

## Value of x in a)

We write given expression as,

$x+2=3$

Given that initially x = 1,

Therefore, substitute 1 for x in the below given equation,

x = x+1

= 1+1.

=2

Hence, x = 2.

## Value of x in b)

We write given expression,

Given that x = 1,

$\mathrm{x}+1=1+1\phantom{\rule{0ex}{0ex}}\ne 3$

$2\mathrm{x}+2=2+2\phantom{\rule{0ex}{0ex}}\ne 3$

False or false gives false.

Hence, x = 1

## Value of x in c)

We write given expression as,

Given that x = 1,

$2x+3=2+3\phantom{\rule{0ex}{0ex}}=5$

$3x+4=3+4\phantom{\rule{0ex}{0ex}}=7$

True and true gives true.

Hence, x = 2.

## Value of x in d)

We write given expression,

Given that x = 1,

$\mathrm{x}+1=2$

$\mathrm{x}+2=3$

True Ex-Or True gives false.

Hence, x = 1

## Value of x in e)

We write given expression,

Given that x = 1,

Here 1 < 2

Hence, x = 2.