Admin Name
Dashboard
Categorey
Sub Categorey
Artilces
Users
Settings
Logout
Welcome to the Admin Panel
Create Post
Select Categorey
- Select -
coding
Select Sub Categorey
Title Name :
Defination :
Operators in C# are special symbols or keywords used to perform operations on variables and values. C# supports a rich set of operators, including arithmetic, comparison, logical, assignment, and more. Understanding how these operators work is crucial for writing logical and efficient code.
Code :
using System; class Program { static void Main() { int a = 10; int b = 5; // Arithmetic Operators Console.WriteLine("Addition: " + (a + b)); Console.WriteLine("Subtraction: " + (a - b)); Console.WriteLine("Multiplication: " + (a * b)); Console.WriteLine("Division: " + (a / b)); Console.WriteLine("Modulus: " + (a % b)); // Comparison Operators Console.WriteLine("Is a > b? " + (a > b)); Console.WriteLine("Is a == b? " + (a == b)); // Logical Operators bool x = true, y = false; Console.WriteLine("x && y: " + (x && y)); Console.WriteLine("x || y: " + (x || y)); Console.WriteLine("!x: " + (!x)); } }
Code Part 2 :
int number = 10; // Assignment Operators number += 5; // Same as number = number + 5 Console.WriteLine(number); // Output: 15
Upload Image 1
Upload Image 2
Summary
Operators form the backbone of any programming language. In C#, operators are categorized into several types like arithmetic, comparison, logical, and assignment operators. Mastering these helps in implementing conditions, calculations, and logic efficiently.
YouTube Link
Seo Title
Meta Keywords
Meta Description
Introduction to C#
Edit
Variables and Data Types in C#
Edit
Operators in C#
Edit
Control Statements in C# – if, else, switch, and loops Explained
Edit
Loops in C# – for, while, do while, and foreach
Edit
Jump Statements in C# – break, continue, return Explained with Examples
Edit
Conditional Statements in C# if, else if, else, switch Explained with Examples
Edit
Loops in C# – For, While, and Do While with Examples
Edit
Hrjejd
Edit