Relational Operators in C
C language supports relational operators as <, >, <=, >=, == and != operators. These operators are used to compare the given two operand values.
Any expression that forms with the combination of relational operators and operands is termed as a relational expression.
Operators Example Description
> x > y x is greater than y
< x < y x is less than y
>= x >= y x is greater than or equal to y
<= x <= y x is less than or equal to y
== x == y x is equal to y
!= x != y x is not equal to y
The result of a relational expression is either 1 or 0. Where 1 stands for TRUE and 0 stands for FALSE.
/* EXAMPLE PROGRAMS FOR RELATIONAL OPERATORS */
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
printf("\n Result1:%d",14>78);
printf("\nResult 2:%d",14<78);
printf("\nResult 3:%d",25<=50);
printf("\nResult 4:%d",25>=50);
printf("\nResult 5:%d",100==100);
printf("\nResult 6:%d",100!=100);
}
No comments:
Post a Comment