Thuta Learning
BasicProgrammingbeginner

Operators

Relax. We'll talk through this in plain words — no textbook voice.

Operators are symbols used to calculate values, compare them, and check conditions. Just like + and - on a calculator, operators are the workhorses of your program's logic.

csharp
int price = 100;
int quantity = 3;
int total = price * quantity;

bool hasDiscount = total >= 300;

Console.WriteLine($"Total: {total}");
Console.WriteLine($"Discount allowed: {hasDiscount}");

What to notice in this code

  • * is the multiplication operator, multiplying price by quantity.
  • >= is a comparison operator, checking whether total is greater than or equal to 300.
  • The comparison result is either true or false.
You should see
Total: 300 Discount allowed: True

Info

🔎 Operator groups

Arithmetic: + - * / %; Assignment: = += -=; Comparison: == != > < >= <=; Logical: && || !

Operators | Thuta Learning