Relational operators include the following:
Comparison operators (<, <=, >, and >=) are used to compare two expressions or two values. This comparison results in either a true or false result.
An equivalence operator (==) can be used to evaluate if two values are the same.
The not equal (!=) operator can be used to determine if a value is not equal to another value.
The following is an example of using relational operators.
using System;
namespace Client.Chapter_2___ Expressions_and_ Operators
{
class RelationalOperators
{
static void Main(string[] args)
{
int a, b;
a = 1;
b = 2;
if (a > b)
b = 10;
if (b < a)
a = 10;
if (a >= b)
b = 20;
if (b <= a)
a = 20;
if (a == b)
b = 5;
if (b != a)
b = a;
}
}
}