Operators in C#
Introduction
In this lesson, you will learn operators in C# for beginners. Operators are used to perform operations on variables and values.
What are Operators in C#?
Operators are symbols that perform actions like addition, comparison, and logical checks.
Types of Operators in C#
Arithmetic Operators
Used for mathematical operations:
int a = 10;
int b = 5;
Console.WriteLine(a + b);
Common arithmetic operators:
- + (Addition)
- – (Subtraction)
- * (Multiplication)
- / (Division)
Comparison Operators
Used to compare values:
int a = 10;
int b = 5;
Console.WriteLine(a > b);
Common comparison operators:
- == (Equal)
- != (Not equal)
- > (Greater than)
- < (Less than)
Logical Operators
Used for conditions:
bool result = true && false;
Console.WriteLine(result);
Common logical operators:
- && (AND)
- || (OR)
- ! (NOT)
Real-World Use
- Check login conditions
- Perform calculations
- Validate user input
Key Points
- Operators perform actions on data
- Arithmetic operators are used for calculations
- Logical operators are used in conditions
Internal Links
- Course Page: .NET Course for Beginners



