C# Operators

Operators perform operations by taking one or more values, to give another value. These operations are performed on variables and values. Operators in C# are discussed here. For example:

The following are the operators in C#:

  • Arithmetic Operators
  • Assignment Operators
  • Relational Operators
  • Logical Operators

Let us understand the operators one by one:

C# Arithmetic Operators

Arithmetic operators in C# perform arithmetical operations, such as addition, subtraction, division, multiplication, etc.

C# Arithmetic Operators

Let us see an example of Arithmetic Operators in C#:

Output

C# Assignment Operators

Use the Assignment Operator when you need to assign values to a variable. It also includes the Arithmetic Assignment Operators:

C# Assignment Operators

Let us see an example of Assignment Operators in C#:

Output

C# Relational Operators

Compare two values with C# relational operators, which are also known as Comparison Operators. Let us say a = 3, b =5;

C# Relational Operators

Let us see an example of Relational Operators in C#:

Output

C# Logical Operators

Logical operators combine conditional statements. Considering Boolean variables, a and b,

C# Logical Operators

Let us see an example of Logical Operators in C#:

Output

C# Data Types
C# - Installation and Setup
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading