(De Morgan’s Laws) In this chapter, we discussed the logical operators &&, &, | |, |, ^ and !. De Morgan’s laws can sometimes make it more convenient for us to express a logical expression. These laws state that the expression ! (condition1 && condition2) is logically equivalent to the expression (! Condition1 | | ! condition2). Also, the expression ! (condition1 \ \ condition2) is logically equivalent to the expression (! Condition1 && ! condition2). Use De Morgan’s laws to write equivalent expressions for each of the following, then write an application to show that both the original expression and the new expression in each case produce the same value:
- 1. ! (x < 5) && ! (y >= 7)
- 2. ! (a == b) || ! (g ! = 5)
- 3. ! ((x <= 8) && (y > 4))
- 4. ! ((i >4) || (j <= 6))
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Java How To Program (Early Objects)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (4th Edition)
C How to Program (8th Edition)
C Programming Language
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting out with Visual C# (4th Edition)
- 4arrow_forwardANSWER IN PYTHON PLEASE.arrow_forwardint p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.arrow_forward
- Please answer with explanations.arrow_forward4. The Area of the Target: To decide on prizes for the archery contest, you decided to use the areas of the center and rings. You decided that rings with smaller areas should be worth more points. But how much more? Complete the following investigation to help you decide. a. Find the sequence of the areas of the rings, including the center. (Be careful.) b. Write a recursive formula and an explicit formula for this sequence. C. Write the explicit formula in summation notation. Find the total area of the bull's eye if it had 9 rings around the bull's eye.arrow_forwardComputer Engineering Labarrow_forward
- 5. We are given the statement "C3PO is a droid and Han is not a droid". (a) Using the following statement variables, write the corresponding statement form: Let p = "C3PO is a droid" and q = "Han is a droid" (b) Using De Morgan's Laws, develop the negation of the statement form of part (a) (c) What is the statement that corresponds to the statement form of part (b)?arrow_forwardPlease answer this in c++ asap A very successful cinema director named "Chef" decided to solve the problem. When a customer wants to buy a ticket, the clerk at the ticket window asks the visitor if he or she needs a rest area, and if so, which one: left, right, or both. We know that in the audience they are expected to appear, their L needs a left-handed position, their R needs a right one, Z does not need a single one and B needs both. Your job is to count the number of people who can attend the show. In the theatre there are N rows with each M seat. There is only one lounge between the two adjacent seats. Seats at the beginning and end of the row have two armrests Input 1 223211 Output: 4arrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning