Page 29 - 6437
P. 29
<= Checks if the value of left operand is less than or (A <= B) is
equal to the value of right operand. If yes, then the true.
condition becomes true.
Example
Try the following example to understand all the relational operators available in C:
#include <stdio.h>
main()
{
int a = 21; int b = 10; int c ;
if( a == b )
{
printf("Line 1 - a is equal to b\n" );
}
else
{
printf("Line 1 - a is not equal to b\n" );
}
if ( a < b )
{
printf("Line 2 - a is less than b\n" );
}
else
{
printf("Line 2 - a is not less than b\n" );
}
if ( a > b )
{
printf("Line 3 - a is greater than b\n" );
}
else
{
31