what are the differences between relational and boolean expr

what are the differences between relational and boolean expressions ?

Solution

Logical operator are as follows
\" OR\" represented as || in c++. It operates on two operands and return a boolean value (0 or 1). For example. (condition 1 || condition 2) it will return true if any of the conditions is true

\"AND\" it is represented as \"&&\". It will give true only if both the conditions are true. For example (x>3 && x<7) this expression will be true if both conditions are satisfied that is if x is greater than 3 and less than 7 simultaneously.

\"NOT\" represented as \"!\". Example (!(x==5)) is true if x is not 5. It works like this !(true) is false and ! (false) is true. 0 is also treated as false therfore !0 is true.

Relational operator are as follows
\"EQUAL\" it is represented as\"==\" it.checks for equality. For example. X==5 this expression will be true if value of X is 5

Other relational operator are \">\", \"<\", \"<=\",\">=\" and \"!=\" this is not equal to. They work in similar manner.

what are the differences between relational and boolean expressions ?SolutionLogical operator are as follows \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site