Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta
 You are Here: Home

Programming and discrete maths watch

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? need help thank you

Reply
Submit reply
Turn on thread page Beta
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: November 2, 2015
Today on TSR

Negatives of studying at Oxbridge

What are the downsides?

Poll
Useful resources

Make your revision easier

Can you help? Study Help unanswered threadsStudy Help rules and posting guidelines

Groups associated with this forum:

View associated groups

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.