Challenge: De Morgan's Laws and Primes

Complete the implementation of De Morgan's laws and counting primes challenge.

De Morgan’s laws in C++

Write a C++ code demonstrating De Morgan’s Laws. A quick review shows that:

1. not(A and B) is equal to not(A) or not(B)
2. not(A or B) is equal to not(A) and not(B)

For code purposes, the process looks like this:

  • !(A && B)!(A) || !(B)
  • !(A || B)!(A) && !(B)

You’re provided with two variables: x and y. Replace A and B in code with a suitable expression involving x and y.

Note: Don’t worry if you need help. You can see the solution by pressing the “Show Solution” button.

Get hands-on with 1400+ tech skills courses.