Programming and discrete maths problem

Watch
riccardogee
Badges: 1
Rep:
?
#1
Report Thread starter 5 years ago
#1
Consider these lines of code from a C program:
if (!(x!=0 && y/x < 1)|| x==0)

printf (“True”);

else

printf (“False”);

a. Express the code in this statement as a compound statement using the logical connectives and these predicates

E(x): x = 0

L(x,y): y/x < 1

A(z): “z is assigned to printf”

where x and y are integers and z is a Boolean variable (with values True and False)

b. Use the laws of propositional logic to simplify the statement by expressing it in a simpler form.

c. Translate the answer in part (b) back into C codes.

How can it be solved in easiest way?
0
reply
nerak99
Badges: 13
Rep:
?
#2
Report 5 years ago
#2
Well the first thng to do is use de morgan's law on the statement.
1
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Have you experienced financial difficulties as a student due to Covid-19?

Yes, I have really struggled financially (56)
17.39%
I have experienced some financial difficulties (91)
28.26%
I haven't experienced any financial difficulties and things have stayed the same (120)
37.27%
I have had better financial opportunities as a result of the pandemic (44)
13.66%
I've had another experience (let us know in the thread!) (11)
3.42%

Watched Threads

View All
Latest
My Feed