# Relational Operators : Operators « Language Basics « C# / C Sharp

Relational Operators

```
/*
* C# Programmers Pocket Consultant
* Author: Gregory S. MacBeth
* Email: gmacbeth@comporium.net
* Create Date: June 27, 2003
*/
using System;

namespace Client.Chapter_2___Common_Type_System
{
public 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;
}
}
}

```

### Related examples in the same category

 1 The + Operator Is Left Associative 2 Math Operators with int value 3 Demonstrate the difference between prefix postfix forms of ++ 4 Demonstrate the relational and logical operators 5 Demonstrate the short-circuit operators 6 Side-effects can be important 7 Prevent a division by zero using the ? 1 8 Self increment 9 Self decrease 10 Illustrates the use of the comparison operators 11 Illustrates the use of the Boolean logical operators 12 Ternary operator 13 Illustrates the use of the ternary operator 14 Illustrates the use of the arithmetic operators 15 Illustrates the use of the bitwise operators 16 Illustrates the use of the shortcut operators 17 Prefix and postfix versions of the increment and decrement operators 18 Operator precedence 19 Demonstrates compound assignment operators 20 Relational Operators 3 21 Numeric Operators 3 22 Numeric Operators 1 23 control the operator evaluation sequence 24 'logical and' and bitwise and 25 logical or and bitwise or 26 And Assignment 27 Or Assignment 28 Iff operator in C# 29 logical exclusive-or 30 Conditional operator and Math calculation 31 Add Assigment for both number and string value