logical or Boolean operator

Logical or Boolean operator

    An expression that combines two or more expression s termed as a logical expression .

For combining these expression we use the logical operator .aftter testing   the values of the condition (which is rue or false), it gives the logical   status (true or false) as a net result.

The   oerand may be constant ,variable and expression .C has three logical   operator-

Operator                       meaning
&&                                     AND
||                                          OR
!                                           NOT
AND(&&)operator

       This operator gives the net result true if the condition have the values true ,otherwise gives the result false.

Boolean Table
Condition 1            condition 2               result
False                              false                  false
False                              true                    false
True                                false                  false
True                                 true                   true
Ex-
Let a=10 and b=5
The logical expression   is-
A==10 && b<a

   This gives the result true because both the condition a==10 and b<a

 Is true and gives the net result true-
OR(||) operator-

     This operator gives the  net   result    false .if both the condition. Have the value false .otherwise it gives the result true.

Boolean table
Condition 1       condition2            result
False                      false                 false
False                      true                   true
True                      false                    true
True                      true                      true
 
Ex- let us take the value of two variable a=7 and b=12

 The   logiacal expression is

A<=b||b>15

 This gives the result true because one condition  is true   and gives     the net result true.

NOT (!) operator-

 This is a unary operator   this negates the value   of the condition .if the value of the condition is false then it gives   the result true . if the value of   the condition is true it gives   the result false  .

Boolean  table
Condition       Result
False                  true
True                    false
Ex-
Let us take any variable a=10
These logical expression is
!(a==10)
The value of the condition is true .NOT operator negates the value of the condition .Hence the result is false.

Print | posted on Tuesday, December 18, 2012 4:45 PM


HostAdda - Your Internet Home

Feedback

No comments posted yet.

Your comment:





 
Please add 8 and 7 and type the answer here:

Copyright © Afsana Bano

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski

SimplyRashid.com