Operators
To be continued with Operators......
In this we are going to explore about all the operators
[1].Relational Operators:We often compare two quantities and depending on their relation, take certain decision.To compare two people and other thing like the price of two item.This all the comparision can be done by using relational operators.We have already used the symbol of '>' meaning 'Greater than'.An expression such as......
X>Y or 50>30
*Meaning:the above example want show us that the value of X is greater than Y.Likewise the 50 is greater than 30.
40>39 is the true
BUT
39>40is the false
At this time using 39<40 is exceptable.Which means 39 is less than 40.Here is the table for make it is........
------------------------------------------------------------------------------------------------------------
TABLE FOR RELATIONAL OPRATORS
------------------------------------------------------------------------------------------------------------ Operators Meaning
[1]. < is less than
[2]. <= is less than or equal to
[3]. > is greater than
[4]. >= is greater than or equal to
[5]. = is equal to
[6]. != is not equal to
------------------------------------------------------------------------------------------------------------
[2].Logical Oparetors:In realation oprators,C has the following three iogical oprators.
&& Meaning AND
|| Meaning OR
!! Meaning NOT
The Logical oprator && and || are used when we want to test more than onecodition and make decision.An example is......
a>b && X=10
An expresssion of this kind,which combines two or more reiiation expression,is termed as a logical expression or a compound relation expression.Like the simple realtion experession,a logical expression
also yields a value of one or zero.
The logical experession given above is true only if a>b is true and X=10 is true.If either of them are false, the experession is false.
Truth Table
------------------------------------------------------------------------------------------------------------
Operand-1 Operand-2 Value of the expression
op-1&&op-2 op-1||op-2
Non-zero Non-zero 1 1
Non-zero 0 0 1
0 Non-zero 0 1
0 0 0 0
------------------------------------------------------------------------------------------------------------
Stay Tuned..........................................
Comments
Post a Comment