Page 30 - 6437
P. 30
printf("Line 3 - a is not greater than b\n" );
}
/* Lets change value of a and b */
a = 5;
b = 20;
if ( a <= b )
{
printf("Line 4 - a is either less than or equal to b\n" );
}
if ( b >= a )
{
printf("Line 5 - b is either greater than or equal to b\n" );
}
}
When you compile and execute the above program, it produces the following result:
Line 1 - a is not equal to b
Line 2 - a is not less than b
Line 3 - a is greater than b
Line 4 - a is either less than or equal to b
Line 5 - b is either greater than or equal to b
Logical Operators
Following table shows all the logical operators supported by C language. Assume variable
A holds 1 and variable B holds 0, then:
Oper Description Example
ator
&& Called AND both (A
Logical operator. f the the && ) s
operands are non-zero, then condition false.
becomes true.
|| Called Logical OR Operator. If any of the two (A || B) is
operands is non-zero, then the condition true.
32