Use de-morgans laws to write the equivlant expressions of each of the following and then write a program to show that both the original expression and the new expression in each case are equivlant. Write in C programming language
a) !(x< 5) && !(y>=7)
b) !(a==b) || !(g != 5)
c) !((x<=8) && (y> 4))
d) !(( i > 4) || !(j<=6))
The following is source code for the above question in C programming language. Also, the comments have been added in the source code itself to have a better understanding of the code.
//include the header files
//define the main function
//declare the required variables
int x = 9, y = 2,a = 4,b = 4, g = 5, i = 3, j = 10;
//display the values of the variables declared
printf( "The current variable values are: ");
printf( "x = %d, y = %d, a = %d, b = %d ", x, y, a, b);
printf( "g = %d, y = %d, i = %d, j = %d ", g, y, i, j );
//write the conditional statement using if else and by applying the de-morgans law
//check the if condition and if it is true then display the if statement otherwise
//display the else statement for each part of the question.
if ( ( !( x < 5 ) && !( y >= 7 ) ) == ( !( ( x < 5 ) || ( y >= 7 ) ) ) )
printf( "!( x < 5 ) && !( y >= 7 ) is equivalent to !( ( x < 5 ) || ( y >= 7 ) ) " );
printf( "!( x < 5 ) && !( y >= 7 ) is not equivalent to !( ( x < 5 ) || ( y >= 7 ) ) " );
if ( ( !( a == b ) || !( g != 5 ) ) == ( !( ( a == b ) && ( g != 5 ) ) ) )
printf( "!( a == b ) || !( g != 5 ) is equivalent to !( ( a == b ) && ( g != 5 ) ) " );
printf( "!( a == b ) || !( g != 5 ) is not equivalent to !( ( a == b ) && ( g != 5 ) ) " );
if ( !( ( x <= 8 ) && ( y > 4 ) ) == ( !( x <= 8 ) || !( y > 4 ) ) )
printf( "!( ( x <= 8 ) && ( y > 4 ) ) is equivalent to ( !( x <= 8 ) || !( y > 4 ) ) " );
printf( "!( ( x <= 8 ) && ( y > 4 ) ) is not equivalent to ( !( x <= 8 ) || !( y > 4 ) ) ");
if ( !( ( i > 4 ) || !( j <= 6 ) ) == ( !( i > 4 ) && ( j <= 6 ) ) )
printf( "!( ( i > 4 ) || !( j <= 6 ) ) is equivalent to ( !( i > 4 ) && ( j <= 6 ) ) " );
printf( "!( ( i > 4 ) || !( j <= 6 ) ) is not equivalent to ( !( i > 4 ) && ( j <= 6 ) ) ");
//end of main function
Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*See Solution
Q: What is beta testing?
A: Beta Testing: DefinitionA beta test is the second phase of software testing in software development ...
Q: analyze each program and figure out what is wrong with the memory management in the code and how to ...
A: The larger input will give error “free(): invalid next size (fast)” as the statement “q = malloc(siz...
Q: Design a 4bits combinational circuit 2’s complementer (the output generates the 2’s complement of th...
A: Truth Table which generates the 2’s compliment of input binary number is given below:
Q: Did I correctly perform the SQL query below (photo attached): Create a query that is based on two ta...
A: The given query is performed correctly:SELECT COURSE_TITLE, COURSE_DESCRIPTION FROM COURSE INNER JOI...
Q: What is an example of a query that is based on the tables (attached) and includes both an arithmeti...
A: Query:SELECT COURSE.COURSE_TITLE, COURSE.COURSE_DESCRIPTION, COURSE.COURSE_TYPE_CODE FROM COURSE INN...
Q: Write a program that reads a list of words. Then, the program outputs those words and their frequenc...
A: Program:#print the statementprint ("Enter the input:") #get the input and store it a variablesentenc...
Q: What are features of Unified Communications Systems? How do they benefit the businesses that deploy ...
A: The unified Communication system is a type of business-class platform that combines all the latest d...
Q: Hi, I am programming in java. The instructions require: Create a new project and call it Project8. C...
A: All the changes are commented above the modified or added line.In main() method Mymethod() called an...
Q: In C++: Explain and show how to use the recursive function int gcd (inta, int b).
A: C++ Source Code//include the required header file#include<iostream>using namespace std;//Decla...