Consider these lines of code from a C program:
if (!(x!=0 && y/x < 1)|| x==0)
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?
x Turn on thread page Beta
Programming and discrete maths problem watch
- Thread Starter
- 02-11-2015 13:47
- 02-11-2015 14:12
Well the first thng to do is use de morgan's law on the statement.